Illegal instruction... g++ && clang++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0  |pateo@17:39:08 /tmp>$ clang++-3.9 -Wall  /tmp/pthread.cc -lpthread
/tmp/pthread.cc:20:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
0 |pateo@17:39:11 /tmp>$ ./a.out
here #9
Illegal instruction (core dumped)
132|pateo@17:39:13 /tmp>$ g++ -Wall /tmp/pthread.cc -lpthread
/tmp/pthread.cc: In function ‘int startCloudThread()’:
/tmp/pthread.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
0 |pateo@17:39:23 /tmp>$ ./a.out
here #9

CODE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

void *testThread(void *arg) {
printf("here #%d\n", __LINE__);
return NULL;
}

int startCloudThread() {
pthread_t aa;
if (pthread_create(&aa, NULL, testThread, NULL)) {
printf("pthread_create (%s)", strerror(errno));
return -1;
}
pthread_join(aa, NULL);
}

int main() {
startCloudThread();

return 0;
}