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

            Bug ID: 126240
           Summary: ranger: frange cannot represent the inverse of a
                    floating point constant
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldyh at gcc dot gnu.org
                CC: amacleod at redhat dot com, jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 65026
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65026&action=edit
sample lapack source file with inequalities with FP constants

I instrumented the floating point intensive lapack package to catch any DOM <->
ranger inconsistencies.  While running f951 over the preprocessed fortran files
I ran into 56 failures into a total of 3631.

ISTM that all of them are our inability to represent the inverse of a floating
constant, not just 0.0.

As a formality I’m including a preprocessed source that triggers my
instrumentation, but really, it should be obvious even without a testcase.  We
just don’t have support for != C, and never have.

You can run the test with:

f951 -ffixed-form -O2 -quiet testcase-dtrsm.f

A reduced gimple FE testcase that may be easier to deal with follows, and can
even be seen by evrp time:

// { dg-do compile }
// { dg-options "-O2 -fgimple -fdump-tree-evrp" }

// Test that frange can represent the inverse of a constant.
//
// This was reduced from the LAPACK package: dtrsm.f

int g;

int __GIMPLE (ssa, startwith ("evrp"))
some_constant (double x)
{
  __BB(2):
  if (x_1(D) != 1.0e+0)
    goto __BB3;
  else
    goto __BB5;

  __BB(3):
  g = 1;
  goto __BB4;

  __BB(4):
  if (x_1(D) == 1.0e+0)         // should fold to false
    goto __BB5;
  else
    goto __BB6;

  __BB(5):
  return 0;

  __BB(6):
  return 1;
}

// { dg-final { scan-tree-dump-not "if \\(x_1\\(D\\) == 1\\.0e\\+0\\)" "evrp" }
}

Reply via email to