http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46972
Summary: __thread storage class variable gets optimized out on ARM Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: paulius.zalec...@gmail.com Created attachment 22775 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22775 test case source code My host system is x86_64 and I am cross compiling this file(attached) for ARM with following command: arm-unknown-linux-uclibcgnueabi-gcc -pipe -O1 -Wall thread_test.c -o thread_test Executing ./thread_test on my ARM system results in segfault. If I comment out test_set() function or remove __thread specifier or compile it without optimizations (-O0) test passes. I tried this test also on my host system (Fedora 14) and it does not fail there. My cross compiler is vanila GCC + patches from: http://git.buildroot.net/buildroot/tree/toolchain/gcc/4.5.1 It took me about a week to realize what is going on and make this test case out of not working cross compiled pulseaudio-0.9.22 server :)