Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: "um" <dont_email@xxxxxxxxxx>
- Date: Wed, 20 Apr 2005 06:17:29 +0200
BTW, here is the output:
Microsoft (R) Program Maintenance Utility Version 8.00.40607.16
Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : warning U4004: too many rules for target 'sizes.pass'
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. semaphore1.c
/Fesemaphore1.exe /link /INCREMENTAL:NO pthreadVC2.lib ws2_32.lib
cl : Command line warning D9035 : option 'Yd' has been deprecated and will be
removed in a future release
semaphore1.c
.... Running VC test: semaphore1.exe
thread: sem_trywait 1: expected error: No error
Assertion failed: (errnoSav == EAGAIN), file semaphore1.c, line 91
NMAKE : fatal error U1077: '.\semaphore1.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: 'nmake' : return code '0x2'
Stop.
"um" wrote
> "David Schwartz" wrote
> > "um" wrote
> > > "David Schwartz" wrote
> > >> "um" wrote
> > >>
> > >> > It is the last assert which fails in the first of the failing test
> > >> > programs.
> > >>
> > >> Why should 'perror' be expected to cause an 'EGAIN' error? You need
> > >> to
> > >> test 'errno' before calling any library functions that might change its
> > >> value. This code is broken.
> > >
> > > The code is not broken.
> >
> > It is.
> >
> > > In your quote you have left out the
> > > relevant part of the code.
> > > It is not perror which sets errno (funny imagination, btw).
> >
> > How do you know that?
>
> Experience, and simple testing. Here is the proof. Take a look to the
> lines with comments marked with "// UM"
>
> void *
> thr(void * arg)
> {
> sem_t s;
> int result;
> int errnoSav; // UM
>
> assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
>
> assert((result = sem_trywait(&s)) == -1);
> errnoSav = errno; // UM
> if ( result == -1 )
> {
> perror("thread: sem_trywait 1: expected error"); // No error
> assert(errnoSav == EAGAIN); // UM: was "errno"; Error happens here
(still)
> }
> else
> {
> printf("thread: ok 1\n");
> }
>
> ...
>
> > > errno is set by sem_trywait(). The code is:
> >
> > yes, it's set by 'sem_trywait', but then the code calls 'perror' before
> > checking it!
> >
> > > assert((result = sem_trywait(&s)) == -1);
> > > if ( result == -1 )
> > > {
> > > perror("thread: sem_trywait 1: expected error"); // No error
> > > assert(errno == EAGAIN);
> >
> > Again, why would you expect 'perror' to set errno to 'EAGAIN'? Do you
> > have some documentation that says 'perror' is guaranteed not to change
> > errno?
>
> No, it's not me, it's you who falsely thinks so. Therefore I've changed the
code
> to satisfy your view. But: the result is the same. The generated code of
> VC++2005 crashes at the same location with the same error. Need more?
> FYI: there are 122 test programs in total. 26 of them do fail with VC++2005
> (see original posting for the list of the failing tests). Funny thing: VC++6
> passes all tests flawlessly, so does the GNU compiler.
>
> I hope it helps the developers at MS to fix the product. If more
> info needed just let me know. BTW, I'm not involved in the
> pthreads development; I'm just testing both products for suitability
> and usability for some portable low-level hi-speed application projects
> for Windows and Linux. Some of the developers insist on using
> the latest product version, so I've first to check whether it makes sense,
> or rather creates problems...
.
- References:
- VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: Carl Daniel [VC++ MVP]
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: David Schwartz
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: David Schwartz
- Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- From: um
- VC++ 2005 beta1 fails with pthreads benchmark tests
- Prev by Date: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Next by Date: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Previous by thread: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Next by thread: Re: VC++ 2005 beta1 fails with pthreads benchmark tests
- Index(es):
Relevant Pages
|