[Bug rtl-optimization/55950] New: Invalid sqrt constant propagation with -frounding-mode

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 11 22:13:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55950

             Bug #: 55950
           Summary: Invalid sqrt constant propagation with -frounding-mode
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


simplify_const_unary_operation (in simplify-rtx.c) does constant propagation
for SQRT protected only by:

       if (HONOR_SNANS (mode) && real_isnan (&d))
         return 0;

With -frounding-math, it should check whether sqrt was exact and only propagate
in that case (sqrt(1)=1, sqrt(.25)=.5, but sqrt(2) should wait for execution).

(note that this doesn't happen on a trivial sqrt(2.) example, but I've already
seen it happen)



More information about the Gcc-bugs mailing list