diff mbox

Bootstrap failure/ ICE in rtl.h (was: Re: [PATCH 225/236] Work towardgmane.comp.gcc.patchess NEXT_INSN/PREV_INSN requiring insns as their params)

Message ID 1408499766.2473.132.camel@surprise
State New
Headers show

Commit Message

David Malcolm Aug. 20, 2014, 1:56 a.m. UTC
On Wed, 2014-08-20 at 00:15 +0200, Tobias Burnus wrote:
> I am not sure about which patch causes the problem, but with Rev. 214197 
> boostrapping fails here (x86-64-gnu-linux) while an incremental build 
> with a few other of your changes it worked.
> 
> Currently, it fails in Stage 1 with the Stage 1 compiler with the 
> following message.
> 
> Tobias
> 
> 
> ../../../../libgcc/soft-fp/subtf3.c: In function '__subtf3':
> ../../../../libgcc/soft-fp/subtf3.c:51:1: internal compiler error: 
> Segmentation fault
>   }
>   ^
> 0xc4856a crash_signal
>          ../../gcc/toplev.c:337
> 0x763f08 bool is_a_helper<rtx_insn*>::test<rtx_def>(rtx_def*)
>          ../../gcc/rtl.h:683
> 0x7646a9 bool is_a<rtx_insn*, rtx_def>(rtx_def*)
>          ../../gcc/is-a.h:182
> 0x7e9228 rtx_insn* as_a<rtx_insn*, rtx_def>(rtx_def*)
>          ../../gcc/is-a.h:192
> 0x7e6b5c duplicate_insn_chain(rtx_def*, rtx_def*)
>          ../../gcc/cfgrtl.c:4169
> 0x7e6c65 cfg_layout_duplicate_bb
>          ../../gcc/cfgrtl.c:4191
> 0x7ce90b duplicate_block(basic_block_def*, edge_def*, basic_block_def*)
>          ../../gcc/cfghooks.c:1042
> 0x130356d copy_bb
>          ../../gcc/bb-reorder.c:819
> 0x1304b5c connect_traces
>          ../../gcc/bb-reorder.c:1294
> 0x1306b27 reorder_basic_blocks
>          ../../gcc/bb-reorder.c:2258
> 0x1306d54 execute
>          ../../gcc/bb-reorder.c:2352
> Please submit a full bug report,

Sorry about that.

I'm not sure why this didn't make the bootstrap of patches 30-39 fail,
but I was able to reproduce the crash you saw.

The issue was with the as_a<> that I introduced at the end of
duplicate_insn_chain in r214197 (patch #35), which requires a non-NULL
insn.  Converting it to a safe_as_a<> fixes the bootstrap.

I went ahead and committed the fix to trunk, as r214207 (patch attached
for reference).

Sorry again.
Dave
diff mbox

Patch

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 214206)
+++ gcc/ChangeLog	(revision 214207)
@@ -1,3 +1,9 @@ 
+2014-08-20  David Malcolm  <dmalcolm@redhat.com>
+
+	* cfgrtl.c (duplicate_insn_chain): Convert the checked cast on
+	"insn" from an as_a to a safe_as_a, for the case when "insn" is
+	NULL.
+
 2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
 	PR preprocessor/51303
Index: gcc/cfgrtl.c
===================================================================
--- gcc/cfgrtl.c	(revision 214206)
+++ gcc/cfgrtl.c	(revision 214207)
@@ -4166,7 +4166,7 @@ 
     }
   insn = NEXT_INSN (last);
   delete_insn (last);
-  return as_a <rtx_insn *> (insn);
+  return safe_as_a <rtx_insn *> (insn);
 }
 
 /* Create a duplicate of the basic block BB.  */