We were using g++ (GCC) 3.4.6 20060404 (Red Hat 3.4.6.9) on Linux 2.6.24.14 SMP X86_64 GNU/Linux 4-core Intel @2.66GHz. We executed: g++ -O0 test.cc ./a.out ./a.out causes segmentation fault. The file test.cc folows below: __thread int testarray[2]; int main() { int i = 2; testarray[i-1] = 1; int p; p = testarray[i-1]; p = p + 1; printf("%d\n", p); return 0; }
I found this bug while searching for __thread-related problems and FWIW I can't reproduce this on a very similar system with g++ 4.1.2 from Debian stable so maybe this can be closed as fixed.
Fixed.