https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63829
Bug ID: 63829 Summary: Crash in__tls_init when -mcpu=arm1176jzf-s is used Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: aaron at aarongraham dot com ARM processor, Raspberry Pi Offending code: #include <memory> thread_local std::unique_ptr<int> tls_test; struct foo { foo() { tls_test.reset(new int(42)); } } const foo_instance; int main() {} The following works: g++ test.cc -std=c++14 The following crashes: g++ test.cc -std=c++14 -mcpu=arm1176jzf-s I will attach the full disassembly for both. Here's the basic gdb output: Core was generated by `./a.out'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00008668 in __tls_init () (gdb) bt #0 0x00008668 in __tls_init () #1 0x00008a14 in TLS wrapper function for tls_test () #2 0x000086ec in foo::foo() () #3 0x00008648 in __static_initialization_and_destruction_0(int, int) () #4 0x000086d0 in _GLOBAL__sub_I_tls_test () #5 0x00008a78 in __libc_csu_init () #6 0x4f508f18 in __libc_start_main () from /opt/armtools/20141030/arm-brcm-linux-gnueabi/sysroot/lib/libc.so.6 #7 0x000084fc in _start () (gdb) info reg r0 0x10da0 69024 r1 0xffff 65535 r2 0xc 12 r3 0x0 0 r4 0x2 2 r5 0x10c64 68708 r6 0x2 2 r7 0x1 1 r8 0xafb35654 2947765844 r9 0xafb3565c 2947765852 r10 0x4f3a7000 1329229824 r11 0xafb354ac 2947765420 r12 0xffff0fff 4294905855 sp 0xafb354a8 0xafb354a8 lr 0x8a14 35348 pc 0x8668 0x8668 <__tls_init+16> cpsr 0x60000010 1610612752 (gdb)