http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47909
Summary: referring to __thread var with -fpic -O0 ICEs final_scan_insn on m68k-linux Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: mi...@it.uu.se > cat /tmp/pie-1.c __thread int a; int main(void) { return a; } > /tmp/objdir46/gcc/xgcc -B/tmp/objdir46/gcc/ -O0 -fpic -S /tmp/pie-1.c /tmp/pie-1.c: In function 'main': /tmp/pie-1.c:2:1: error: insn does not satisfy its constraints: (insn 22 2 5 (set (reg:SI 0 %d0 [33]) (const:SI (unspec:SI [ (symbol_ref:SI ("a") [flags 0x10] <var_decl 0xb75c8f60 a>) (const_int 1 [0x1]) ] 6))) /tmp/pie-1.c:2 36 {*movsi_m68k} (nil)) /tmp/pie-1.c:2:1: internal compiler error: in final_scan_insn, at final.c:2579 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Same result with -fPIC or -fpie. Goes away with -O1 or higher. This bug causes gcc.dg/tls/pie-1.c to fail with gcc-4.5.2 and gcc-4.6.0. Doesn't ICE gcc-4.4.5, but there it uses emutls (4.5 added NPTL support). binutils-2.20.1, glibc-2.11.2 w/ NPTL backported. > /tmp/objdir46/gcc/xgcc -v Using built-in specs. COLLECT_GCC=/tmp/objdir46/gcc/xgcc Target: m68k-unknown-linux Configured with: /tmp/gcc-4.6-20110219/configure --target=m68k-unknown-linux --prefix=/home/mikpe/pkgs/linux-x86/cross-m68k --with-gmp=/home/mikpe/pkgs/linux-x86/gmp-4.3.2 --with-mpfr=/home/mikpe/pkgs/linux-x86/mpfr-2.4.2 --with-mpc=/home/mikpe/pkgs/linux-x86/mpc-0.8.2 --disable-plugin --disable-lto --disable-nls --enable-shared --disable-libmudflap --disable-multilib --enable-threads=posix --enable-checking=release --enable-languages=c Thread model: posix gcc version 4.6.0 20110219 (experimental) (GCC)