gcc/ChangeLog:
PR tree-optimization/97396
* gimple-range.cc (gimple_ranger::range_of_phi): Do not call
range_of_ssa_name_with_loop_info with the loop tree root.
gcc/testsuite/ChangeLog:
* gcc.dg/pr97396.c: New test.
{
value_range loop_range;
class loop *l = loop_containing_stmt (phi);
- if (l)
+ if (l && loop_outer (l))
{
range_of_ssa_name_with_loop_info (loop_range, phi_def, l, phi);
if (!loop_range.varying_p ())
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O1 -ftree-vrp" }
+// { dg-additional-options "-m32" { target { i?86-*-* x86_64-*-* } } }
+
+unsigned int
+po (char *os, unsigned int al)
+{
+ for (;;)
+ {
+ int qx = 0;
+
+ while (al < 1)
+ {
+ char *cw;
+
+ cw = os + qx;
+ if (cw)
+ return al + qx;
+
+ qx += sizeof *cw;
+ }
+ }
+}