https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120638

--- Comment #2 from chenglulu <chenglulu at loongson dot cn> ---
I compared the test.c.141t.dom2 and testf.c.208t.dom3
dom2:
```
range_of_expr (_5) [frange] float [1.0e+0 (0x0.8p+1), 6.5536e+4 (0x0.8p+17)]
range_of_expr (_6) [frange] float [7.62939453125e-6 (0x0.8p-16), 5.0e-1
(0x0.8p+0)]
...
  step.0_1 = step;
  _2 = (double) step.0_1;
  _3 = _2 + 1.0e+0;
  _4 = (float) _3;
  _5 = sqrtf (_4);
  _6 = 5.0e-1 / _5;
  test1 (_6);
```
I think the range of _5 and _6 in dom2 is correct.

dom3:
```
range_of_expr (_5) [frange] float [1.0e+0 (0x0.8p+1), 6.5536e+4 (0x0.8p+17)]
range_of_expr (_6) [frange] float [5.0e-1 (0x0.8p+0), 5.0e-1 (0x0.8p+0)]
...
  step.0_1 = step;
  _2 = (double) step.0_1;
  _3 = _2 + 1.0e+0;
  _4 = (float) _3;
  _5 = .RSQRT (_4);
  _6 = _5 * 5.0e-1;
  test1 (5.0e-1);
```
But in dom3, the range of _5 is wrong. The error is caused by the calculation
of the range of .RSQRT(_4) is [-0.0, +Inf]. This result intersects with the
range of _5 calculated in the previous optimization pass ,and we get [1.0e+0
(0x0.8p+1), 6.5536e+4 (0x0.8p+17)]. Then use the range of _5 to calculate the
range of _6, which is [5.0e-1 (0x0.8p+0),3.2768e+4]. Then take the intersection
again, the range of _6 is  [5.0e-1 (0x0.8p+0), 5.0e-1 (0x0.8p+0)].

Reply via email to