[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-03-07 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

--- Comment #12 from Jeffrey A. Law  ---
Author: law
Date: Mon Mar  7 17:01:54 2016
New Revision: 234036

URL: https://gcc.gnu.org/viewcvs?rev=234036=gcc=rev
Log:
PR tree-optimization/69740
* cfghooks.c (remove_edge): Request loop fixups if we delete
an edge that might turn an irreducible loop into a natural
loop.
* cfgloop.h (check_verify_loop_structure): Clear LOOPS_NEED_FIXUP.
Move after definition of loops_state_clear.

PR tree-optimization/69740
* gcc.c-torture/compile/pr69740-1.c: New test.
* gcc.c-torture/compile/pr69740-2.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr69740-1.c
trunk/gcc/testsuite/gcc.c-torture/compile/pr69740-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfghooks.c
trunk/gcc/cfgloop.h
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-03-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

Richard Biener  changed:

   What|Removed |Added

   Keywords||ice-checking
   Priority|P3  |P2

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-27 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

--- Comment #11 from Jeffrey A. Law  ---
Author: law
Date: Sun Feb 28 06:43:07 2016
New Revision: 233788

URL: https://gcc.gnu.org/viewcvs?rev=233788=gcc=rev
Log:


Revert
2016-02-26  Richard Biener  
Jeff Law  

Backport from mainline
2016-02-26  Richard Biener  
Jeff Law  

PR tree-optimization/69740
* cfghooks.c (remove_edge): Request loop fixups if we delete
an edge that might turn an irreducible loop into a natural
loop.


Revert
2016-02-26  Richard Biener  
Jeff Law  

Backport from mainline
2016-02-26  Richard Biener  
Jeff Law  

PR tree-optimization/69740
* gcc.c-torture/compile/pr69740-1.c: New test.
* gcc.c-torture/compile/pr69740-2.c: New test.

2016-02-26  Richard Biener  

Removed:
branches/gcc-5-branch/gcc/testsuite/gcc.c-torture/compile/pr69740-1.c
branches/gcc-5-branch/gcc/testsuite/gcc.c-torture/compile/pr69740-2.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/cfghooks.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-27 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=69989
 Resolution|FIXED   |---
Summary|[5 Regression] gcc ICE at   |[5/6 Regression] gcc ICE at
   |-O2 and above on valid code |-O2 and above on valid code
   |on x86_64-linux-gnu in  |on x86_64-linux-gnu in
   |"verify_loop_structure" |"verify_loop_structure"

--- Comment #10 from Jeffrey A. Law  ---
Patch reverted from trunk and gcc-5 branch, re-opened.

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-26 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

--- Comment #6 from Jeffrey A. Law  ---
Author: law
Date: Fri Feb 26 18:17:02 2016
New Revision: 233754

URL: https://gcc.gnu.org/viewcvs?rev=233754=gcc=rev
Log:
PR tree-optimization/69740
* cfghooks.c (remove_edge): Request loop fixups if we delete
an edge that might turn an irreducible loop into a natural
loop.

PR tree-optimization/69740
* gcc.c-torture/compile/pr69740-1.c: New test.
* gcc.c-torture/compile/pr69740-2.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr69740-1.c
trunk/gcc/testsuite/gcc.c-torture/compile/pr69740-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfghooks.c
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-24 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

--- Comment #5 from Jeffrey A. Law  ---
The testcase in c#3 is another instance of this problem, but triggered by
sinking.  I'd already been pondering the benefit/risk of attacking this at a
higher level (like in delete_basic_block) and seeing another instance from a
completely different codepath makes me think this check ought to be implemented
in a common path rather than in each place were we call delete_basic_block.

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-24 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com

--- Comment #4 from Jeffrey A. Law  ---
By the definition of BB_IRREDUCIBLE_LOOP, e2->dest->flags should not be marked
as irreducible.  BB_IRREDUCIBLE_LOOP is set for blocks that are actually in the
irreducible loop.  In this case e2->dest refers to BB3, which is outside the
irreducible loop.

One could argue that we need a similar test applied to the outgoing edges of
blocks that get marked as unreachable.   ie, if we have an unreachable block
with an outgoing edge to an irreducible loop, then set LOOPS_NEED_FIXUP.

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-21 Thread helloqirun at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

--- Comment #3 from Qirun Zhang  ---
(In reply to Jakub Jelinek from comment #1)
> Started with r218566.

Here is a similar case. The stack trace is almost the same as in the original
RP's. However, this one crashes the current trunk at -O3 only (The original RP
still crashes the current trunk at -O2 and above).

I am not sure if this is a dup of the original RP..


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160221 (experimental) [trunk revision 233594] (GCC)

$ gcc-trunk -O2 abc.c
$ gcc-trunk -Os abc.c
$ gcc-trunk -O3 abc.c
abc.c: In function 'main':
abc.c:7:5: error: loop with header 5 not in loop tree
 int main() {
 ^~~~
abc.c:7:5: internal compiler error: in verify_loop_structure, at cfgloop.c:1639
0x75e6bf verify_loop_structure()
../../gcc/gcc/cfgloop.c:1639
0x9d9e9e checking_verify_loop_structure
../../gcc/gcc/cfgloop.h:324
0x9d9e9e loop_optimizer_init(unsigned int)
../../gcc/gcc/loop-init.c:106
0xd198dd execute
../../gcc/gcc/tree-ssa-sink.c:619
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


$ cat abc.c
inline int foo(int *p1, int p2) {
  int z = *p1;
  while (z > p2)
p2 = 2;
  return z;
}
int main() {
  int i;
  for (;;) {
int j, k;
i = foo(, 7);
if (k)
  j = i;
else
  k = j;
if (2 != j)
  __builtin_abort();
  }
}

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

--- Comment #2 from Jakub Jelinek  ---
So, in *.mergephi1 we have:
  :
  b.0_4 = b;
  if (b.0_4 != 0)
goto ;
  else
goto ;

  :
  c[0] = 0;

l1:
  c ={v} {CLOBBER};

  :
  a.1_7 = a;
  if (a.1_7 != 0)
goto  (l1);
  else
goto ;
Then DSE1 removes the c[0] = 0;, but the loop still has multiple entries at
that point.  Then in cddce the
if (b.0_4 != 0)
statement is removed as unnecessary and remove_dead_stmt has:
/* If we made a BB unconditionally exit a loop or removed
   an entry into an irreducible region, then this transform
   alters the set of BBs in the loop.  Schedule a fixup.  */
if (loop_exit_edge_p (bb->loop_father, e)
|| (e2->dest->flags & BB_IRREDUCIBLE_LOOP))
  loops_state_set (LOOPS_NEED_FIXUP);
remove_edge (e2);
but e2->dest->flags doesn't have BB_IRREDUCIBLE_LOOP set and e is not exit edge
of the only loop in the loop structure (loop 0).
So, should there be an irreducible loop before cddce?  Or should DCE mark loops
for fixup even in this case?  Richard, can you please have a look?

[Bug tree-optimization/69740] [5/6 Regression] gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure"

2016-02-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69740

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-02-10
 CC||jakub at gcc dot gnu.org
   Target Milestone|--- |5.4
Summary|gcc ICE at -O2 and above on |[5/6 Regression] gcc ICE at
   |valid code on   |-O2 and above on valid code
   |x86_64-linux-gnu in |on x86_64-linux-gnu in
   |"verify_loop_structure" |"verify_loop_structure"
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Started with r218566.