https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109410

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #13)
> So the testcase gcc.dg/pr109410.c passes but if you add -g, the ICE will
> show up still.
> 
> This also means there will be some compare-debug failure too as the IR/CFG
> will be different with/without -g.
> 
> I suspect gsi_after_labels here should really be
> gsi_start_nondebug_after_labels_bb .

That is:
diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
index 067a3f07f7e..c71780e6d54 100644
--- a/gcc/tree-ssa-reassoc.cc
+++ b/gcc/tree-ssa-reassoc.cc
@@ -1563,7 +1563,7 @@ build_and_add_sum (tree type, tree op1, tree op2, enum
tree_code opcode)
   if ((!op1def || gimple_nop_p (op1def))
       && (!op2def || gimple_nop_p (op2def)))
     {
-      gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
+      gsi = gsi_start_nondebug_after_labels_bb (single_succ
(ENTRY_BLOCK_PTR_FOR_FN (cfun)));
       if (!gsi_end_p (gsi)
          && is_gimple_call (gsi_stmt (gsi))
          && (gimple_call_flags (gsi_stmt (gsi)) & ECF_RETURNS_TWICE))

Reply via email to