Shouldn't unsafe-math-optimizations (re-)enable fp-contract=fast?
Ian Bolton
ian.bolton@arm.com
Fri Mar 7 16:29:00 GMT 2014
> Thanks for the feedback, Joseph.
>
> I've been working on the patch, but I see in gcc/opts.c that there is
> a definite distinction between set_fast_math_flags and
> set_unsafe_math_optimizations_flags. I'm thinking this is more of a
> fast-math thing than an unsafe_math_optimizations thing, so I should
> actually be adding it in set_fast_math_flags.
>
> Is this correct?
Scratch that. I went ahead and tried to set it in opts.c, but the c-opts.c
override (to OFF) will currently happen in every case UNLESS you explicitly
asked for -ffp-contract=fast.
I therefore think the better solution is now to not override it in c-opts
if unsafe-math-optimizations (which itself is enabled by -ffast-math and/or
-Ofast) is enabled. We already have fp-contract=fast on by default, so we
should just stop it being turned off unnecessarily instead.
I've successfully coded this one and it works as expected when compiled
with "-Ofast -std=c99". I'll prepare the patch now.
Cheers,
Ian
More information about the Gcc
mailing list