https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106234
Bug ID: 106234
Summary: [13 Regression] stack overflow from range_from_dom
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
Some recent commit on the testcase below with -O2 -funswitch-loops
-fno-thread-jumps blows the stack due to deep recursion
#0 0x0000000000f33a1b in range_query::get_tree_range (this=0x5bc6d78, r=...,
expr=0x7ffff68e10f0, stmt=0x7fffe99fafa0)
at /space/rguenther/src/gcc/gcc/value-query.cc:214
#1 0x0000000001892bfc in ranger_cache::range_of_expr (this=<optimized out>,
r=..., name=<optimized out>, stmt=<optimized out>)
at /space/rguenther/src/gcc/gcc/gimple-range-cache.cc:978
...
(gdb) up 10000
#7950 0x00000000007103eb in main (argc=8, argv=0x7fffffffdd48)
at /space/rguenther/src/gcc/gcc/main.cc:39
39 int r = toplev.main (argc, argv);
with range_from_dom appearing a lot of times. -fno-tree-dominator-opts
-fno-tree-vrp "fixes" this.
extern int foo (int);
int bar(int flag)
{
int res = 0;
#define A \
for (int i = 0; i < 1024; ++i) if (flag) res ^= foo(i);
#define B A A A A A A A A A A
#define C B B B B B B B B B B
#define D C C C C C C C C C C
#define E D D D D D D D D D D
E
return res;
}
it looks like range_from_dom walks up immediate dominators but in that loop
recurses to itself!? isn't that quadratic? shouldn't the recursion stop
at the next immediate dominator of the recursion invoker?