Je précise que je cause bien de cette ligne du programme de l'OP :
if(pthread_create(&num_thread, NULL, (void *(*)())addition, NULL) == -1) perror("pb pthread_create\n");
Ce n'est pas autorisé car pthread tentera d'invoquer addition en déréférençant donc le pointeur vers un type autre que son type d'origine (cf. section 6.3.2.3.8 de la norme ISO : If a converted pointer is used to call a function whose type is not compatible with the referenced type, the behavior is undefined.).
La solution est d'écrire un wrapper, comme je l'ai mentionné.
Partager