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

--- Comment #4 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> Ah, probably the
> 
> void test(double f, double i)
> {
> ...
>   if (i != __builtin_inf())
>     abort ();
> 
> int main()
> {
>   test (34.0, __builtin_inf());
> ...
> 
> test is "miscompiled", similar to what we see in povray.
> 
> We can probably gate parts of the testcase with
> 
> #if __FINITE_MATH_ONLY__ == 0

Yeah, I saw that.  Agreed that we should predicate parts of this testcase.

Also, it seems weird that the gimple representation is inconsistent between the
conditional and the call site.  Before einline we have:

void test (double f, double i)
{
  <bb 2> :
  if (i_1(D) <= 3.4028234663852885981170418348451692544e+38)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  abort ();

  <bb 4> :
  return;

}

int main ()
{
  <bb 2> :
  test (3.4e+1,  Inf);

}

Which the inliner through some unknown mechanism (to me), folds to a call to
abort in main.  This is before evrp or ethread.  I wonder how it folded that
with.  Anywho..that's neither here nor there.

What I'm concerned is that INF is being expanded differently between test and
main.  Shouldn't we at least be consistent?

Reply via email to