seen with current branches and trunk when building libcap-ng on sparc/sparc64. the file builds without -fPIC or with -O0. Matthias $ gcc-4.4 -c -O2 -fPIC cap-ng.i cap-ng.c: In function 'init': cap-ng.c:154: error: unrecognizable insn: (insn 18 17 19 4 cap-ng.c:139 (set (reg:SI 117) (lo_sum:SI (reg:SI 117) (unspec:SI [ (symbol_ref:SI ("m") [flags 0x1a] <var_decl 0xf7bafad0 m>) ] 0))) -1 (nil)) cap-ng.c:154: internal compiler error: in extract_insn, at recog.c:2048 Please submit a full bug report, with preprocessed source if appropriate.
Created attachment 19429 [details] preprocessed source
I cannot reproduce with a cross, neither on mainline nor 4.4 branch. Could you post the command line passed to cc1? Do you have relevant local patches?
I couldn't reproduce this either.
the sparc64-linux compiler from the trunk is configured with --with-pkgversion='Debian 20091228-2' --with-bugurl='file:///usr/share/doc/gcc-snapshot/README.Bugs' --enable-languages=c,c++,java,fortran,objc,obj-c++ --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --disable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=//usr/lib/jvm/java-1.5.0-gcj-4.5-snap/jre --enable-java-home --with-jvm-root-dir=//usr/lib/jvm/java-1.5.0-gcj-4.5-snap --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.5-snap --with-arch-directory=sparc64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --disable-multilib --with-long-double-128 --disable-werror --build=sparc64-linux-gnu --host=sparc64-linux-gnu --target=sparc64-linux-gnu COLLECT_GCC_OPTIONS='-v' '-c' '-fPIC' '-O2' '-mcpu=v9' /usr/lib/gcc-snapshot/libexec/gcc/sparc64-linux-gnu/4.5.0/cc1 -fpreprocessed cap-ng.i -quiet -dumpbase cap-ng.i -mcpu=v9 -auxbase cap-ng -O2 -version -fPIC -o /tmp/ccGcfzUk.s patches applied are: pr40521-revert-workaround: Revert the dwarf2cfi_asm workaround, obsoleted by PR debug/40521. gcc-ice-hack: Retry the build on an ice, save the calling options and preprocessed source when the ice is reproducible. gcc-ice-apport: Report an ICE to apport (if apport is available and the environment variable GCC_NOAPPORT is not set) plus two build patches for libjava and gcc/config/arm. started a build without the pr40521-revert-workaround
not applying the pr40521-revert-workaround patch shows the ICE as well.
I can reproduce on native (and with a cross by stealing the native auto-host.h).
Created attachment 19451 [details] Reduced testcase. Requires TLS support.
The root of the problem is plus_constant wrapping up a TLS symbol in a CONST: (const:DI (plus:DI (symbol_ref:DI ("m") [flags 0x1a] <var_decl m>) (const_int 4 [0x4]))) what the SPARC back-end doesn't like. So something like this works: Index: explow.c =================================================================== --- explow.c (revision 155516) +++ explow.c (working copy) @@ -137,7 +137,8 @@ plus_constant (rtx x, HOST_WIDE_INT c) case SYMBOL_REF: case LABEL_REF: - all_constant = 1; + if (CONSTANT_ADDRESS_P (x)) + all_constant = 1; break; case PLUS: but I presume other back-ends may not necessarily like it.
Subject: Bug 42564 Author: ebotcazou Date: Tue Jan 5 22:29:18 2010 New Revision: 155662 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155662 Log: PR target/42564 * config/sparc/sparc.h (SPARC_SYMBOL_REF_TLS_P): Delete. * config/sparc/sparc-protos.h (legitimize_pic_address): Likewise. (legitimize_tls_address): Likewise. (sparc_tls_referenced_p): Likewise. * config/sparc/sparc.c (sparc_expand_move): Use legitimize_tls_address and adjust calls to legitimize_pic_address. (legitimate_constant_p) Use sparc_tls_referenced_p. (legitimate_pic_operand_p): Likewise. (sparc_legitimate_address_p): Do not use SPARC_SYMBOL_REF_TLS_P. (sparc_tls_symbol_ref_1): Delete. (sparc_tls_referenced_p): Make static, recognize specific patterns. (legitimize_tls_address): Make static, handle CONST patterns. (legitimize_pic_address): Make static, remove unused parameter and adjust recursive calls. (sparc_legitimize_address): Make static, use sparc_tls_referenced_p and adjust call to legitimize_pic_address. (sparc_output_mi_thunk): Likewise. Added: trunk/gcc/testsuite/gcc.dg/tls/opt-15.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/sparc/sparc-protos.h trunk/gcc/config/sparc/sparc.c trunk/gcc/config/sparc/sparc.h trunk/gcc/testsuite/ChangeLog
Subject: Bug 42564 Author: ebotcazou Date: Tue Jan 5 22:32:25 2010 New Revision: 155663 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155663 Log: PR target/42564 * config/sparc/sparc.h (SPARC_SYMBOL_REF_TLS_P): Delete. * config/sparc/sparc-protos.h (legitimize_pic_address): Likewise. (legitimize_tls_address): Likewise. (sparc_tls_referenced_p): Likewise. * config/sparc/sparc.c (sparc_expand_move): Use legitimize_tls_address and adjust calls to legitimize_pic_address. (legitimate_constant_p) Use sparc_tls_referenced_p. (legitimate_pic_operand_p): Likewise. (sparc_legitimate_address_p): Do not use SPARC_SYMBOL_REF_TLS_P. (sparc_tls_symbol_ref_1): Delete. (sparc_tls_referenced_p): Make static, recognize specific patterns. (legitimize_tls_address): Make static, handle CONST patterns. (legitimize_pic_address): Make static, remove unused parameter and adjust recursive calls. (sparc_legitimize_address): Make static, use sparc_tls_referenced_p and adjust call to legitimize_pic_address. (sparc_output_mi_thunk): Likewise. Added: branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tls/opt-15.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/config/sparc/sparc-protos.h branches/gcc-4_4-branch/gcc/config/sparc/sparc.c branches/gcc-4_4-branch/gcc/config/sparc/sparc.h branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
Subject: Bug 42564 Author: ebotcazou Date: Tue Jan 5 22:34:01 2010 New Revision: 155664 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155664 Log: PR target/42564 * config/sparc/sparc.h (SPARC_SYMBOL_REF_TLS_P): Delete. * config/sparc/sparc-protos.h (legitimize_pic_address): Likewise. (legitimize_tls_address): Likewise. (sparc_tls_referenced_p): Likewise. * config/sparc/sparc.c (sparc_expand_move): Use legitimize_tls_address and adjust calls to legitimize_pic_address. (legitimate_constant_p) Use sparc_tls_referenced_p. (legitimate_pic_operand_p): Likewise. (sparc_legitimate_address_p): Do not use SPARC_SYMBOL_REF_TLS_P. (sparc_tls_symbol_ref_1): Delete. (sparc_tls_referenced_p): Make static, recognize specific patterns. (legitimize_tls_address): Make static, handle CONST patterns. (legitimize_pic_address): Make static, remove unused parameter and adjust recursive calls. (sparc_legitimize_address): Make static, use sparc_tls_referenced_p and adjust call to legitimize_pic_address. (sparc_output_mi_thunk): Likewise. Added: branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/tls/opt-15.c Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/sparc/sparc-protos.h branches/gcc-4_3-branch/gcc/config/sparc/sparc.c branches/gcc-4_3-branch/gcc/config/sparc/sparc.h branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
On all active branches.