Created attachment 28089 [details] Reduced from libjava/java/lang/natClassLoader.cc $ gcc/xgcc -B gcc/ -O2 -fnon-call-exceptions natClassLoader.ii -S natClassLoader.ii: In function ‘void _Jv_PushClass(jclass)’: natClassLoader.ii:51:1: internal compiler error: in pre_and_rev_post_order_compute, at cfganal.c:873 Started with r190602.
Starting program: /home/stevenb/devel/build-debug/gcc/cc1plus -quiet PR54385.cc -O2 -fnon-call-exceptions Breakpoint 1, fancy_abort (file=0x1147c0a0 "../../trunk/gcc/cfganal.c", line=873, function=0x1147c1c0 "pre_and_rev_post_order_compute") at ../../trunk/gcc/diagnostic.c:1011 1011 internal_error ("in %s, at %s:%d", function, trim_filename (file), line); (gdb) up #1 0x00000000105d7d4c in pre_and_rev_post_order_compute (pre_order=0x0, rev_post_order=0x116d5580, include_entry_exit=false) at ../../trunk/gcc/cfganal.c:873 873 gcc_assert (pre_order_num == n_basic_blocks - NUM_FIXED_BLOCKS); (gdb) p brief_dump_cfg(stderr,-1) ;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 0, next block 3, flags: (REACHABLE, RTL, MODIFIED) ;; pred: ENTRY [100.0%] (FALLTHRU) ;; succ: 3 [100.0%] (FALLTHRU) ;; basic block 3, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 2, next block 4, flags: (REACHABLE, RTL, MODIFIED) ;; pred: 2 [100.0%] (FALLTHRU) ;; succ: EXIT [100.0%] (ABNORMAL,SIBCALL) ;; basic block 4, loop depth 0, count 0, freq 0 ;; prev block 3, next block 1, flags: (REACHABLE, RTL, MODIFIED) ;; pred: ;; succ: $5 = void (gdb) p current_pass->name $6 = 0x114a27d8 "postreload" So there's an unreachable block and it confuses pre_and_rev_post_order_compute. Someone has removed a critical edge between the ICE point and the start of postreload. This is the CFG on entry to rest_of_handle_postreload: ;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 0, next block 3, flags: (REACHABLE, RTL, MODIFIED) ;; pred: ENTRY [100.0%] (FALLTHRU) ;; succ: 4 (ABNORMAL,EH) ;; 3 [100.0%] (FALLTHRU) ;; basic block 3, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 2, next block 4, flags: (REACHABLE, RTL, MODIFIED) ;; pred: 2 [100.0%] (FALLTHRU) ;; succ: EXIT [100.0%] (ABNORMAL,SIBCALL) ;; basic block 4, loop depth 0, count 0, freq 0 ;; prev block 3, next block 1, flags: (REACHABLE, RTL, MODIFIED) ;; pred: 2 (ABNORMAL,EH) ;; succ: The edge disappears in reload_cse_regs_1, which is not CFG aware (like most of postreload, it seems). This is a pre-existing problem that happens to be exposed by my patch.
Created attachment 28090 [details] Try to delete unreachable blocks if any edges were removed
I just hit this ICE trying to built trunk @ r192837 as a cross to m68k-linux with java enabled. Steven's patch fixed the ICE. (The java build also needed my proposed PR49847 patch.)
Author: steven Date: Fri Nov 9 12:31:32 2012 New Revision: 193359 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193359 Log: PR middle-end/54385 * postreload.c (reload_cse_simplify): Return a bool indicating whether the CFG was changed. (reload_cse_regs_1): Traverse the CFG instead of the insns chain. Cleanup the CFG if edges may have been removed. (reload_cse_regs): Update. Modified: trunk/gcc/ChangeLog trunk/gcc/postreload.c
.