aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2017-03-29 22:53:59 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2017-03-29 22:53:59 +0200
commit533c0b69430beae5274a7f456e299afb16afc2f0 (patch)
tree5b85b3acab57500c6da7fff23473f5f7c7223dc4 /gcc/combine.c
parent6f8de3dd3ca509a4fa8544aa3c32501affc88ac4 (diff)
downloadgcc-533c0b69430beae5274a7f456e299afb16afc2f0.zip
gcc-533c0b69430beae5274a7f456e299afb16afc2f0.tar.gz
gcc-533c0b69430beae5274a7f456e299afb16afc2f0.tar.bz2
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
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index c118aa2..87daa28 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1250,10 +1250,10 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
continue;
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);
if (last_combined_insn == NULL_RTX
- || BARRIER_P (last_combined_insn)
|| BLOCK_FOR_INSN (last_combined_insn) != this_basic_block
|| DF_INSN_LUID (last_combined_insn) <= DF_INSN_LUID (insn))
last_combined_insn = insn;