https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89573
Bug ID: 89573 Summary: -fexcess-precision=standard doesn't work for conversion to integer of multiplication Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- The following, built with -m32 -march=i586 -fexcess-precision=standard on x86_64-linux outputs a: -75345 b: -75346 c: -75346 where the first result is off. The IL looks like int r = (int) ((long double) log (p) * (long double) inv_log_of_base); where possibly the missing cast to (double) is elided by bogus optimization (didn't try to track down the issue yet). -ffloat-store makes the testcase work as does any optimization (well, we then get constant folding). #include <math.h> #include <stdio.h> int main(int argc, char **argv) { double p = 0.00053447623258905705; double inv_log_of_base = 10000.499991668185; int r = log(p) * inv_log_of_base; printf("a: %d\n", r); double gr = log(p) * inv_log_of_base; printf("b: %g\n", gr); double g = log(p); int c = g * inv_log_of_base; printf("c: %d\n", c); return 0; }