http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50963
Bug #: 50963 Summary: TLS incompatible with -mcmodel=large & PIC Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: drepper....@gmail.com Due to some build problems with the default models a program was compiled with -mcmodel=large. But that seems to be incompatible with TLS in PIC. This tiny code sequence blows up gcc as recently as 4.6.2 (from Fedora rawhide): __thread int a; int f(int b) { return a; } The ICE message when compiled with 'g++ -c -mcmodel=large t.c -fpic' is: t.c: In function ‘int f(int)’: t.c:6:1: error: unrecognizable insn: (call_insn/u 6 5 7 3 (parallel [ (set (reg:DI 0 ax) (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr")) [0 S1 A8]) (const_int 0 [0]))) (unspec:DI [ (symbol_ref:DI ("a") [flags 0x10] <var_decl 0x7f55292c31e0 a>) ] UNSPEC_TLS_GD) ]) t.c:5 -1 (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000]) (nil)) (nil)) t.c:6:1: internal compiler error: in extract_insn, at recog.c:2109