"Carl Daniel [VC++ MVP]" wrote
um wrote: When the POSIX pthreads library for w32 release 2-2-0
(http://sources.redhat.com/pthreads-win32/) is compiled with VC++6
then it compiles and passes all the benchmark tests in the
subdirectory "tests". Also, VC++ 2005 beta 1 compiles the tests fine,
but here the following
tests fail in execution:
# semaphore1.pass \
# condvar2.pass \
# condvar2_1.pass \
# mutex8.pass \
# mutex8n.pass \
# mutex8e.pass \
# mutex8r.pass \
# condvar3.pass \
# condvar3_1.pass \
# condvar3_2.pass \
# condvar3_3.pass \
# condvar4.pass \
# condvar5.pass \
# condvar6.pass \
# condvar7.pass \
# condvar8.pass \
# condvar9.pass \
# rwlock7.pass \
# rwlock8.pass \
# rwlock2_t.pass \
# rwlock3_t.pass \
# rwlock4_t.pass \
# rwlock5_t.pass \
# rwlock6_t.pass \
# rwlock6_t2.pass \
# spin4.pass \
Why are there such differences in execution of the generated code
between VC++6 and VC++2005 ? Is this due to bugs in the beta1,
or is this the result of general differences between the two products?
Are there any compiler/linker switches for backwards "compatibility"
to VC++6?
You're going to need to post a lot more details to get a satisfying answer,
unless a pthreads-win32 expert happens to read this newsgroup.
I'd suggest examining a single failure in depth with the goal of producing a
simple small program that behaves differently on VC6 versus VC8 beta 1 (also
note that beta 2 was released lasts Friday).
Here is the result of the compile and test execution process for VC++2005.
I have appended also the code location of the first failed test (semaphore1.c).
As said, VC++6 compiles and passes all tests, whereas VC++2005 fails
with many of the tests.
---
Setting environment for using Microsoft Visual Studio 2005 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vsvars32.bat for that version.)
E:\>cd F:\FILES\Thread_Programming\pthreads\MyTests\tests
E:\>f:
F:\FILES\Thread_Programming\pthreads\MyTests\tests >nmake clean VC
Microsoft (R) Program Maintenance Utility Version 8.00.40607.16
Copyright (C) Microsoft Corporation. All rights reserved.
erase *.dll
erase *.lib
erase pthread.h
erase semaphore.h
erase sched.h
erase *.e
Could Not Find F:\FILES\Thread_Programming\pthreads\MyTests\tests \*.e
erase *.i
Could Not Find F:\FILES\Thread_Programming\pthreads\MyTests\tests \*.i
erase *.obj
erase *.pdb
erase *.o
Could Not Find F:\FILES\Thread_Programming\pthreads\MyTests\tests \*.o
erase *.asm
Could Not Find F:\FILES\Thread_Programming\pthreads\MyTests\tests \*.asm
erase *.exe
erase *.pass
erase *.bench
Could Not Find F:\FILES\Thread_Programming\pthreads\MyTests\tests \*.bench
erase *.log
Could Not Find F:\FILES\Thread_Programming\pthreads\MyTests\tests \*.log
Microsoft (R) Program Maintenance Utility Version 8.00.40607.16
Copyright (C) Microsoft Corporation. All rights reserved.
Copying pthreadVC2.lib
1 file(s) copied.
Copying pthreadVC2.dll
1 file(s) copied.
Copying pthread.h
1 file(s) copied.
Copying semaphore.h
1 file(s) copied.
Copying sched.h
1 file(s) copied.
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. sizes.c /Fesizes.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
sizes.c
NMAKE : warning U4004: too many rules for target 'sizes.pass'
.... Running VC2 test: sizes.exe
Sizes of pthreads-win32 structs
-------------------------------
pthread_t 8
ptw32_thread_t 136
pthread_attr_t_ 28
sem_t_ 12
pthread_mutex_t_ 24
pthread_mutexattr_t_ 8
pthread_spinlock_t_ 8
pthread_barrier_t_ 24
pthread_barrierattr_t_ 4
pthread_key_t_ 16
pthread_cond_t_ 32
pthread_condattr_t_ 4
pthread_rwlock_t_ 28
pthread_rwlockattr_t_ 4
pthread_once_t_ 16
ptw32_cleanup_t 12
sched_param 4
-------------------------------
....... Passed
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. loadfree.c
/Feloadfree.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
loadfree.c
1 file(s) copied.
1 file(s) copied.
.... Running VC test: loadfree.exe
....... Passed
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. self1.c /Feself1.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
self1.c
.... Running VC test: self1.exe
....... Passed
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. mutex5.c /Femutex5.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
mutex5.c
.... Running VC test: mutex5.exe
....... Passed
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. mutex1.c /Femutex1.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
mutex1.c
.... Running VC test: mutex1.exe
....... Passed
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. mutex1n.c
/Femutex1n.exe /link /INCREMENTAL:NO pthreadVC2.lib ws2_32.lib
cl : Command line warning D9035 : option 'Yd' has been deprecated and will be rem
oved in a future release
mutex1n.c
.... Running VC test: mutex1n.exe
....... Passed
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. mutex1e.c
/Femutex1e.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
mutex1e.c
.... Running VC test: mutex1e.exe
....... Passed
cl /D__CLEANUP_C /O2 /Ob0 /W3 /WX /MD /nologo /Yd /Zi -I. mutex1r.c
/Femutex1r.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
mutex1r.c
.... 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.
--
The first error happens with semaphore1.exe (semaphore1.c line 89):
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);
It is the last assert which fails in the first of the failing test programs.