View previous topic :: View next topic |
Author |
Message |
CarterCox n00b
Joined: 28 Jan 2018 Posts: 34
|
Posted: Tue Apr 24, 2018 2:51 pm Post subject: [SOLVED]Is Ofast dangerous? |
|
|
Pretty much what the title says. I read in the wiki it's not recommended, but it doesn't say why. And the GCC manual doens't say anything about that either. Thanks!
Last edited by CarterCox on Tue Apr 24, 2018 4:24 pm; edited 1 time in total |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54244 Location: 56N 3W
|
Posted: Tue Apr 24, 2018 3:21 pm Post subject: |
|
|
CarterCox,
-Ofast gets you -ffast-math for free.
If you can live with non standards compliant floating point arithmetic, -ffast-math is safe.
If you don't use floating point at all, or know the results are not affected by -ffast-math, then -ffast-math is safe for your use case.
There may my other standards thrown out the window too.
Its not something you want system wide, since you don't have the time to do the required validation.
I have feeling that -O3 turns on -ffast-math so thats to be avoided system wide too. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21635
|
Posted: Wed Apr 25, 2018 1:40 am Post subject: |
|
|
According to info gcc, -Ofast is -O3 plus -ffast-math and "optimizations that are not valid for all standard-compliant programs", which suggests -O3 does not set -ffast-math. The description of -O3 does not mention enabling -ffast-math. I think that -O3 has historically been discouraged for good reasons not relating to -ffast-math. |
|
Back to top |
|
|
|