Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Insure++ Red Hat 7.1 pthread_create error: too many arguments in function

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in Insure++
Issue:

The “too many arguments in function call pthread_create”, PARSE_ERROR reported by Insure++ when building a threaded applications on Red Hat 7.1 using gcc 3.x



Cause:
If your operating system is Linux Red Hat 7.1 and you have recently upgraded your compiler to gcc 3.x, or above you may be experiencing this PARSE_ERROR, because of a broken system header. The gcc 3.x compiler added support for __thread keyword, and your system pthread.h and sigthread.h header files, may have the __thread as a variable name in parameter list of the function definition.



Repair:
Modify the variable __thread in the parameter list of the pthread.h header file. For example,

FROM:
extern int pthread_create (pthread_t *__restrict __thread,
__const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
void *__restrict __arg) ;

TO:
extern int pthread_create (pthread_t *__restrict __thr,
__const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
void *__restrict __arg) ;





Workaround:

Add ‘—mpf –no_thread_local_storage to your command line. For example

Insure gcc –g –mpf –no_thread_local_storage –o threads threads.c –lpthread
Tagged: