[Bug debug/80025] [5/6/7 Regression] ICE w/ -O2 (-O3, -Ofast) -g -ftracer (infinite recursion in rtx_equal_for_cselib_1)

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

--- Comment #14 from Jakub Jelinek  ---
Author: jakub
Date: Fri Mar 31 06:05:47 2017
New Revision: 246606

URL: https://gcc.gnu.org/viewcvs?rev=246606=gcc=rev
Log:
PR debug/80025
* cselib.h (rtx_equal_for_cselib_1): Add depth argument.
(rtx_equal_for_cselib_p): Pass 0 to it.
* cselib.c (cselib_hasher::equal): Likewise.
(rtx_equal_for_cselib_1): Add depth argument.  If depth
is 128, don't look up VALUE locs and punt.  Increment
depth in recursive calls when walking VALUE locs.

* gcc.dg/torture/pr80025.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr80025.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cselib.c
trunk/gcc/cselib.h
trunk/gcc/testsuite/ChangeLog

[Bug debug/80025] [5/6/7 Regression] ICE w/ -O2 (-O3, -Ofast) -g -ftracer (infinite recursion in rtx_equal_for_cselib_1)

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

--- Comment #13 from Jakub Jelinek  ---
(In reply to Bernd Schmidt from comment #12)
> That still doesn't seem to address the root cause though? Isn't the problem
> that this reversible mappings code can create cycles and we should avoid
> creating these in the first place?

They can create cycles, but we can't avoid creating them generally, they are
very important for the debug info quality; if there is no cycle, it isn't a
problem, and determining whether there is a cycle is hard, because the locs
lists aren't cast in stone, they actually can have further locs added or
removed as the cselib processing goes on; and rtx_equal_for_cselib_1 is used
while they are still in flux.  Furthermore, even if there is a cycle, the
comparison function might not run into the cycle.  With the cap the comparison
function might try to use some other location in another recursion level and be
successful.

[Bug debug/80025] [5/6/7 Regression] ICE w/ -O2 (-O3, -Ofast) -g -ftracer (infinite recursion in rtx_equal_for_cselib_1)

2017-03-23 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80025

--- Comment #12 from Bernd Schmidt  ---
That still doesn't seem to address the root cause though? Isn't the problem
that this reversible mappings code can create cycles and we should avoid
creating these in the first place?

[Bug debug/80025] [5/6/7 Regression] ICE w/ -O2 (-O3, -Ofast) -g -ftracer (infinite recursion in rtx_equal_for_cselib_1)

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

--- Comment #11 from Jakub Jelinek  ---
Created attachment 41034
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41034=edit
gcc7-pr80025.patch

Untested alternate patch.