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: unassig...@gcc.gnu.org ReportedBy: gli...@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)