/test/gnu/gcc/objdir/./gcc/xgcc -B/test/gnu/gcc/objdir/./gcc/ -B/opt/gnu64/gcc/g cc-4.3.0/hppa64-hp-hpux11.11/bin/ -B/opt/gnu64/gcc/gcc-4.3.0/hppa64-hp-hpux11.11 /lib/ -isystem /opt/gnu64/gcc/gcc-4.3.0/hppa64-hp-hpux11.11/include -isystem /op t/gnu64/gcc/gcc-4.3.0/hppa64-hp-hpux11.11/sys-include -g -fkeep-inline-functions -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmis sing-prototypes -Wold-style-definition -isystem ./include -fPIC -Dpa64=1 -DELF =1 -mlong-calls -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED - I. -I. -I../.././gcc -I../../../gcc/libgcc -I../../../gcc/libgcc/. -I../../../gc c/libgcc/../gcc -I../../../gcc/libgcc/../include -DHAVE_CC_TLS -o _multc3.o -MT _multc3.o -MD -MP -MF _multc3.dep -DL_multc3 -c ../../../gcc/libgcc/../gcc/libg cc2.c \ -fvisibility=hidden -DHIDE_EXPORTS ../../../gcc/libgcc/../gcc/libgcc2.c: In function '__multc3': ../../../gcc/libgcc/../gcc/libgcc2.c:1890: internal compiler error: in local_cpr op_pass, at gcse.c:3236 This is in stage1. Last revision known to build was 127133. __multc3 Analyzing compilation unit Performing interprocedural optimizations <visibility> <early_local_cleanups> <inline> <static-var> <pure-const> <type-escape-var>Assembling functions: __multc3 Breakpoint 1, local_cprop_pass (alter_jumps=1 '\001') at ../../gcc/gcc/gcse.c:3236 3236 gcc_assert (libcall_sp == &libcall_stack[MAX_NESTED_LIBCALLS]); (gdb) bt #0 local_cprop_pass (alter_jumps=1 '\001') at ../../gcc/gcc/gcse.c:3236 #1 0x40000000003df728 in one_cprop_pass (pass=2, cprop_jumps=1 '\001', bypass_jumps=1 '\001') at ../../gcc/gcc/gcse.c:3408 #2 0x40000000003d5270 in gcse_main (f=0x0) at ../../gcc/gcc/gcse.c:796 #3 0x40000000003ec020 in rest_of_handle_gcse () at ../../gcc/gcc/gcse.c:6696 #4 0x400000000047a640 in execute_one_pass (pass=0x80000001000027c8) at ../../gcc/gcc/passes.c:1119 #5 0x400000000047a968 in execute_pass_list (pass=0x80000001000027c8) at ../../gcc/gcc/passes.c:1172 #6 0x400000000047a9ac in execute_pass_list (pass=0x8000000100002a08) at ../../gcc/gcc/passes.c:1173 #7 0x400000000062434c in tree_rest_of_compilation (fndecl=0x800003fffde65400) at ../../gcc/gcc/tree-optimize.c:405 #8 0x40000000001b924c in c_expand_body (fndecl=0x0) at ../../gcc/gcc/c-common.c:4334 #9 0x40000000007fbab4 in cgraph_expand_function (node=0x800003fffdb17c00) at ../../gcc/gcc/cgraphunit.c:1077 #10 0x40000000007fbe18 in cgraph_expand_all_functions () at ../../gcc/gcc/cgraphunit.c:1146 #11 0x40000000007fc9b0 in cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1353 #12 0x400000000015fc78 in c_write_global_declarations () at ../../gcc/gcc/c-decl.c:7897 ---Type <return> to continue, or q <return> to quit--- #13 0x40000000005a00a8 in compile_file () at ../../gcc/gcc/toplev.c:1056 #14 0x40000000005a3824 in do_compile () at ../../gcc/gcc/toplev.c:2150 #15 0x40000000005a3940 in toplev_main (argc=60, argv=0x800003fffdff0848) at ../../gcc/gcc/toplev.c:2182 #16 0x40000000002056b8 in main (argc=0, argv=0x0) at ../../gcc/gcc/main.c:35 (gdb) c Continuing. ../../../gcc/libgcc/../gcc/libgcc2.c: In function '__multc3': ../../../gcc/libgcc/../gcc/libgcc2.c:1890: internal compiler error: in local_cprop_pass, at gcse.c:3236
*** Bug 33030 has been marked as a duplicate of this bug. ***
This was introduced in revision 127273.
Created attachment 14060 [details] preprocessed source Added preprocessed source.
r127273 is this patch: http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00165.html My initial reaction was, "What happens to the REG_RETVAL note, if the insn with the REG_LIBCALL note?" I don't know what happens with the REG_LIBCALL note, but if it disappears with the insn that's being deleted, then you should also remove the REG_RETVAL note, or you're creating something that will look like nested libcalls (which gcse.c handles, but they're actually not allowed). So, can you check what happens with the REG_RETVAL note, please?
Starting program: /home/steven/devel/build-test/gcc/cc1 -g -O2 -fPIC -Dpa64=1 -mlong-calls -fkeep-inline-functions libgcc2.i __multc3 Analyzing compilation unit Performing interprocedural optimizations <visibility> <early_local_cleanups> <inline> <static-var> <pure-const> <type-escape-var>Assembling functions: __multc3 Breakpoint 1, fancy_abort (file=0xcdbc31 "../../trunk/gcc/gcse.c", line=3236, function=0xcdc050 "local_cprop_pass") at ../../trunk/gcc/diagnostic.c:655 655 internal_error ("in %s, at %s:%d", function, trim_filename (file), line); (gdb) up #1 0x00000000006dcd3a in local_cprop_pass (alter_jumps=1 '\001') at ../../trunk/gcc/gcse.c:3236 3236 gcc_assert (libcall_sp == &libcall_stack[MAX_NESTED_LIBCALLS]); (gdb) l 3231 } 3232 3233 /* Forget everything at the end of a basic block. Make sure we are 3234 not inside a libcall, they should never cross basic blocks. */ 3235 cselib_clear_table (); 3236 gcc_assert (libcall_sp == &libcall_stack[MAX_NESTED_LIBCALLS]); 3237 } 3238 3239 cselib_finish (); 3240 (gdb) Definitely a problem with the nested libcalls handling.
Created attachment 14064 [details] remove nested libcall handling from gcse.c This is the *only* place in the entire compiler where GCC handles nested libcalls. I've had this patch for a long time now, but no-one seemed to be interested much in doing something about libcall notes. Maybe someone wants to finish this patch now?
Fix for the bug: Index: lower-subreg.c =================================================================== --- lower-subreg.c (revision 127558) +++ lower-subreg.c (working copy) @@ -897,7 +897,7 @@ resolve_simple_move (rtx set, rtx insn) static bool resolve_clobber (rtx pat, rtx insn) { - rtx reg; + rtx reg, note; enum machine_mode orig_mode; unsigned int words, i; int ret; @@ -909,8 +909,11 @@ resolve_clobber (rtx pat, rtx insn) /* If this clobber has a REG_LIBCALL note, then it is the initial clobber added by emit_no_conflict_block. We were able to decompose the register, so we no longer need the clobber. */ - if (find_reg_note (insn, REG_LIBCALL, NULL_RTX) != NULL_RTX) + note = find_reg_note (insn, REG_LIBCALL, NULL_RTX); + if (note != NULL_RTX) { + rtx retval_insn = XEXP (note, 0); + remove_retval_note (retval_insn); delete_insn (insn); return true; } In case someone cares enough to fix this properly: GCC should probably also remove the REG_LIBCALL_ID notes of all the insns in the libcall chain -- but we don't do that anywhere else right now and the above patch is sufficient to avoid the ICE.
I can confirm the patch in comment 7 fixes the bootstrap failure here. Thanks!
*** Bug 33240 has been marked as a duplicate of this bug. ***
Any news on this bug?
Subject: Re: [4.3 Regression] libgcc2.c:1890: internal compiler error: in local_cprop_pass, at gcse.c:3236 > Any news on this bug? I have been building with Steven's change for the past couple of weeks and haven't seen any new problems. Dave
a hppa-linux-gnu -> hppa64-linux-gnu cross compiler builds with this patch. Matthias
Ian, how are we going to fix this? Steven helpfully provided two solutions but he is no longer a maintainer. The second has been independently tested several times. I have also tested that reverting your change fixes the build failure on hppa64-hp-hpux11.11.
Subject: Bug 33029 Author: ian Date: Wed Sep 5 05:31:37 2007 New Revision: 128119 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128119 Log: PR middle-end/33029 * lower-subreg.c (resolve_clobber): If we remove a REG_LIBCALL note, remove the associated REG_RETVAL note. Modified: trunk/gcc/ChangeLog trunk/gcc/lower-subreg.c
Fixed.