[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-30 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

--- Comment #9 from Segher Boessenkool  ---
Yeah exactly...  so I'm conflicted whether we need to backport this or not.

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-30 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

--- Comment #8 from Jakub Jelinek  ---
It is probably latent there, there were major changes in the trap and
conditional trap handling in GCC 7, so we likely don't have a testcase right
now that would ICE in 6.

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-30 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

--- Comment #7 from Segher Boessenkool  ---
Is it fixed?  Can this not happen on GCC 6?

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-29 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||trippels at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #6 from Markus Trippelsdorf  ---
Fixed by Segher's commit.

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-29 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

--- Comment #5 from Segher Boessenkool  ---
Author: segher
Date: Wed Mar 29 20:53:59 2017
New Revision: 246575

URL: https://gcc.gnu.org/viewcvs?rev=246575&root=gcc&view=rev
Log:
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.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr80233.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-29 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

--- Comment #4 from Jakub Jelinek  ---
But only at runtime, it is fine if it is never executed.  So I think it is
still ice-on-valid-code.

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-29 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

Segher Boessenkool  changed:

   What|Removed |Added

   Keywords|ice-on-valid-code   |ice-on-invalid-code

--- Comment #3 from Segher Boessenkool  ---
(ice-on-invalid of course, division by 0 is undefined behavior).

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-29 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

--- Comment #2 from Segher Boessenkool  ---
How about this patch instead?

--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1250,7 +1250,8 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
continue;

  while (last_combined_insn
-&& last_combined_insn->deleted ())
+&& (!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)

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-03-29
 CC||jakub at gcc dot gnu.org,
   ||segher at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
This fixes it for me:
--- combine.c.jj1   2017-03-21 15:49:11.0 +0100
+++ combine.c   2017-03-29 07:59:56.627951253 +0200
@@ -1254,6 +1254,7 @@ combine_instructions (rtx_insn *f, unsig
last_combined_insn = PREV_INSN (last_combined_insn);
  if (last_combined_insn == NULL_RTX
  || BARRIER_P (last_combined_insn)
+ || NOTE_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;
but I'll study the combine dumps in more detail.

[Bug rtl-optimization/80233] [7 Regression] ICE in combine_instructions w/ -O2 (and above)

2017-03-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80233

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
   Target Milestone|--- |7.0