[Bug bootstrap/46856] [4.6 regression] internal compiler error in final_scan_insn breaks m68k-linux bootstrap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856 --- Comment #6 from Mikael Pettersson mikpe at it dot uu.se 2011-01-26 14:43:34 UTC --- The loop in reload_combine_recognize_const_pattern contains this check: /* If the add clobbers another hard reg in parallel, don't move it past a real set of this hard reg. */ if (must_move_add clobbered_regno = 0 reg_state[clobbered_regno].real_store_ruid = use_ruid) break; Since the moved add is a cc0 setter, it seems reasonable to check here that it's not moved past another cc0 setter. Replacing the previous patch with the following also restores bootstrap (testsuite still running): --- gcc-4.6-20110115/gcc/postreload.c.~1~ 2010-12-21 15:51:42.0 +0100 +++ gcc-4.6-20110115/gcc/postreload.c 2011-01-18 20:26:39.0 +0100 @@ -1008,6 +1008,11 @@ reload_combine_recognize_const_pattern ( if (must_move_add clobbered_regno = 0 reg_state[clobbered_regno].real_store_ruid = use_ruid) break; +#if defined(HAVE_cc0) + /* Unbreak m68k, see PR bootstrap/46856. */ + if (must_move_add sets_cc0_p (PATTERN (use_insn))) + break; +#endif gcc_assert (reg_state[regno].store_ruid = use_ruid); /* Avoid moving a use of ADDREG past a point where it is stored. */
[Bug bootstrap/46856] [4.6 regression] internal compiler error in final_scan_insn breaks m68k-linux bootstrap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856 --- Comment #5 from Mikael Pettersson mikpe at it dot uu.se 2011-01-18 08:29:42 UTC --- If I hack reload_combine_recognize_const_pattern to bail out early if HAVE_cc0, then the test case doesn't ICE a cross to m68k-linux, and native bootstrap on m68k-linux also succeeds (--enable-languages=c,c++; testsuite currently running). I'm not suggesting this is the proper fix, but at least it identifies roughly were the problem lies. --- gcc-4.6-20110115/gcc/postreload.c.~1~ 2010-12-21 15:51:42.0 +0100 +++ gcc-4.6-20110115/gcc/postreload.c 2011-01-16 12:29:44.0 +0100 @@ -944,6 +944,11 @@ reload_combine_recognize_const_pattern ( int add_moved_after_ruid = 0; int clobbered_regno = -1; +#ifdef HAVE_cc0 + /* Unbreak m68k, see PR bootstrap/46856. */ + return false; +#endif + set = single_set (insn); if (set == NULL_RTX) return false;
[Bug bootstrap/46856] [4.6 regression] internal compiler error in final_scan_insn breaks m68k-linux bootstrap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856 --- Comment #4 from Mikael Pettersson mikpe at it dot uu.se 2010-12-11 12:17:46 UTC --- Jakub's r166371 is innocent, all it did was to revert an expansion mode change in r162618 (2nd PR44790 patch). Trunk actually started to ICE for this test case on m68k in r162270: Author: bernds Date: Fri Jul 16 23:47:46 2010 New Revision: 162270 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=162270 Log: PR target/42235 * postreload.c (reload_cse_move2add): Return bool, true if anything. changed. All callers changed. (move2add_use_add2_insn): Likewise. (move2add_use_add3_insn): Likewise. (reload_cse_regs): If reload_cse_move2add changed anything, rerun reload_combine. (RELOAD_COMBINE_MAX_USES): Bump to 16. (last_jump_ruid): New static variable. (struct reg_use): New members CONTAINING_MEM and RUID. (reg_state): New members ALL_OFFSETS_MATCH and REAL_STORE_RUID. (reload_combine_split_one_ruid, reload_combine_split_ruids, reload_combine_purge_insn_uses, reload_combine_closest_single_use reload_combine_purge_reg_uses_after_ruid, reload_combine_recognize_const_pattern): New static functions. (reload_combine_recognize_pattern): Verify that ALL_OFFSETS_MATCH is true for our reg and that we have available index regs. (reload_combine_note_use): New args RUID and CONTAINING_MEM. All callers changed. Use them to initialize fields in struct reg_use. (reload_combine): Initialize last_jump_ruid. Be careful when to take PREV_INSN of the scanned insn. Update REAL_STORE_RUID fields. Call reload_combine_recognize_const_pattern. (reload_combine_note_store): Update REAL_STORE_RUID field. which supports Jakub's statement that reload_combine_recognize_const_pattern misbehaves.
[Bug bootstrap/46856] [4.6 regression] internal compiler error in final_scan_insn breaks m68k-linux bootstrap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P4 CC||bernds at gcc dot gnu.org, ||jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org 2010-12-09 11:53:06 UTC --- Seems this is caused by postreload being broken for HAVE_cc0 targets. reload_combine_recognize_const_pattern happily moves an add after a CC0 setter (but before CC0 user), breaking the requirement that CC0 setter immediately preceedes CC0 user. HAVE_cc0 targets should just be converted or die, but until that happens, postreload should be probably fixed. P4 as none of the primary/secondary targets is HAVE_cc0.
[Bug bootstrap/46856] [4.6 regression] internal compiler error in final_scan_insn breaks m68k-linux bootstrap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856 --- Comment #3 from Mikael Pettersson mikpe at it dot uu.se 2010-12-09 23:48:36 UTC --- A bisection identified r166371 as the trigger for this bug: Author: jakub Date: Fri Nov 5 19:00:27 2010 New Revision: 166371 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=166371 Log: PR target/45670 * expr.c (expand_expr_real_1) case MEM_REF: Use EXPAND_SUM instead of EXPAND_NORMAL for base expansion. * gcc.target/i386/pr45670.c: New test. Reverting that change from gcc-4.6-20101204 prevents the ICE.
[Bug bootstrap/46856] [4.6 regression] internal compiler error in final_scan_insn breaks m68k-linux bootstrap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856 --- Comment #1 from Mikael Pettersson mikpe at it dot uu.se 2010-12-08 23:22:01 UTC --- Created attachment 22689 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=22689 test case reduced from haifa-sched.c objdir/gcc/xgcc -Bobjdir/gcc -O2 -S pr46856.c pr46856.c: In function 'increase_insn_priority': pr46856.c:27:1: internal compiler error: in final_scan_insn, at final.c:2608 Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions. objdir/gcc/xgcc -v Using built-in specs. COLLECT_GCC=objdir/gcc/xgcc Target: m68k-unknown-linux Configured with: /tmp/gcc-4.6-20101204/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 20101204 (experimental) (GCC)
[Bug bootstrap/46856] [4.6 regression] internal compiler error in final_scan_insn breaks m68k-linux bootstrap
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856 Richard Guenther rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |4.6.0