public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* Some tests fail in VC++2005
@ 2005-04-21 14:05 Uenal Mutlu
  2005-04-22  5:46 ` Ross Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Uenal Mutlu @ 2005-04-21 14:05 UTC (permalink / raw)
  To: pthreads-win32

I've tried the latest 2 pthreads releases with MS compilers.
VC++6 passes all tests, but VC++2005 fails with about 26 of the
test programs (tested only in beta 1, beta 2 is out since last monday
or so but I don't have it yet).
The first one of the failing test programs is semaphore1.c, line 89:

nmake clean VC
...
... Running VC test: mutex1r.exe
...... Passed
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: (errno == EAGAIN), file semaphore1.c, line 89
NMAKE : fatal error U1077: '.\semaphore1.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: 'nmake' : return code '0x2'
Stop.

Below is the function from semaphore1.c where the error occurs.
It is the line
     assert(errno == EAGAIN);
I wonder where errno gets set to this value.
Is it done in sem_trywait() or maybe in perror()?
And frankly I don't understand how the below code works at all
because that branch is entered only if result is -1. The funny
thing here (for me) is that then the program should stop in the
previous assert(), but this isn't happening! Then I wonder how
and why the if condition becomes true...

void *
thr(void * arg)
{
  sem_t s;
  int result;

  assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);

  assert((result = sem_trywait(&s)) == -1);

  if ( result == -1 )
  {
    perror("thread: sem_trywait 1: expected error"); // No error
    assert(errno == EAGAIN);
  }
...

I have posted this issue also in
news://news.microsoft.com/microsoft.public.dotnet.languages.vc
under the subject "VC++ 2005 beta1 fails with pthreads benchmark tests"
but the MS guys say the code is broken. Maybe someone could clarify this.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-04-26  2:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-21 14:05 Some tests fail in VC++2005 Uenal Mutlu
2005-04-22  5:46 ` Ross Johnson
2005-04-22  7:34   ` Steve Croall
2005-04-25  0:20     ` Ross Johnson
2005-04-25  2:33       ` Will Bryant
2005-04-26  2:34         ` Ross Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).