Commit 533c0b69 by Segher Boessenkool Committed by Segher Boessenkool

combine: Fix PR80233

If combine has added an unconditional trap there will be a new basic
block as well.  It will then end up considering the NOTE_INSN_BASIC_BLOCK
as the last_combined_insn, but then it tries to take the DF_INSN_LUID
of that and that dereferences a NULL pointer (since such a note is not
an INSN_P).

This fixes it by not taking non-insns as last_combined_insn.


	PR rtl-optimization/80233
	* combine.c (combine_instructions): Only take NONDEBUG_INSN_P insns
	as last_combined_insn.  Do not test for BARRIER_P separately.

gcc/testsuite/
	PR rtl-optimization/80233
	* gcc.c-torture/compile/pr80233.c: New testcase.

From-SVN: r246575
parent 6f8de3dd
2017-03-29 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/80233
* combine.c (combine_instructions): Only take NONDEBUG_INSN_P insns
as last_combined_insn. Do not test for BARRIER_P separately.
2017-03-29 Andreas Schwab <schwab@suse.de> 2017-03-29 Andreas Schwab <schwab@suse.de>
PR ada/80146 PR ada/80146
......
...@@ -1250,10 +1250,10 @@ combine_instructions (rtx_insn *f, unsigned int nregs) ...@@ -1250,10 +1250,10 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
continue; continue;
while (last_combined_insn while (last_combined_insn
&& last_combined_insn->deleted ()) && (!NONDEBUG_INSN_P (last_combined_insn)
|| last_combined_insn->deleted ()))
last_combined_insn = PREV_INSN (last_combined_insn); last_combined_insn = PREV_INSN (last_combined_insn);
if (last_combined_insn == NULL_RTX if (last_combined_insn == NULL_RTX
|| BARRIER_P (last_combined_insn)
|| BLOCK_FOR_INSN (last_combined_insn) != this_basic_block || BLOCK_FOR_INSN (last_combined_insn) != this_basic_block
|| DF_INSN_LUID (last_combined_insn) <= DF_INSN_LUID (insn)) || DF_INSN_LUID (last_combined_insn) <= DF_INSN_LUID (insn))
last_combined_insn = insn; last_combined_insn = insn;
......
2017-03-29 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/80233
* gcc.c-torture/compile/pr80233.c: New testcase.
2017-03-28 Thomas Koenig <tkoenig@gcc.gnu.org> 2017-03-28 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80254 PR fortran/80254
......
/* PR rtl-optimization/80233 */
int xg;
void
t4 (int o9)
{
int it;
if (o9 == 0)
{
int fx;
xg *= it;
if (xg == 0)
it /= 0;
fx = (it != 0) ? (xg < 0) : (xg / o9);
if (fx != 0)
xg = 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment