https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79436
--- Comment #7 from Richard Earnshaw <rearnsha at gcc dot gnu.org> --- double __attribute__((optimize("fp-contract=off"))) x (double a, double b, double c) { return a*b + c; } You might also need to mark the function as no-inline to prevent it being inlined into functions where the default still applies.