The threader is creating a scenario where we are trying to solve:
[NEGATIVES] = abs(x)
While solving this we have an intermediate value of UNDEFINED because
we have no positive numbers. But then we try to union the negative
pair to the final result by querying the bounds. Since neither
UNDEFINED nor NAN have bounds, they need to be specially handled.
PR tree-optimization/107732
gcc/ChangeLog:
* range-op-float.cc (foperator_abs::op1_range): Early exit when
result is undefined.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr107732.c: New test.
neg_nan.set_nan (type, true);
r.union_ (neg_nan);
}
- if (r.known_isnan ())
+ if (r.known_isnan () || r.undefined_p ())
return true;
// Then add the negative of each pair:
// ABS(op1) = [5,20] would yield op1 => [-20,-5][5,20].
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O2" }
+
+double sqrt(double);
+double a, b, c;
+void d() {
+ for (;;) {
+ c = __builtin_fabs(a);
+ sqrt(c);
+ if (a)
+ a = b;
+ }
+}