| May 21, 2011 11:30 AM PDT | |
The following test case does not work when compiled with Intel compiler 12.0. The exception handling is incorrect and the run-time cannot unwind properly after thread cancelation. The Intel compiler 11.1 works correctly.
$ cat testcase.cpp
#include <pthread.h>
#include <stdio.h>
int counter=0;
class Guard {
public:
Guard() {
++counter;
}
~Guard() {
--counter;
}
};
void *handler_with_guard(void *)
{
Guard l;
pthread_exit(NULL);
}
int main(int argc, char *argv[])
{
pthread_t t;
int result = pthread_create(&t, 0, handler_with_guard, 0);
printf("pthread_create result = %d\n", result);
result = pthread_join(t, NULL);
printf("pthread_join result = %d\n", result);
printf("counter = %d\n", counter);
return 0;
}
$ icc -c testcase.cpp $ icc -lpthread testcase.o $ ./a.out pthread_create result = 0 terminate called without an active exception Aborted (core dumped) $ icc -c -O0 testcase.cpp $ icc -lpthread testcase.o $ ./a.out pthread_create result = 0 pthread_join result = 0 counter = 0
The above testcase is from http://software.intel.com/en-us/forums/showthread.php?t=80459&p=1
Solution:
The issue has been resolve in Intel Compiler 12.0 update 4.
Do you need more help?
This article applies to: Intel® C++ Compiler for Linux* Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (0) 
Trackbacks (0)
Leave a comment 
To obtain technical support, please go to Software Support.

