Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Is Ofast dangerous?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
CarterCox
n00b
n00b


Joined: 28 Jan 2018
Posts: 34

PostPosted: Tue Apr 24, 2018 2:51 pm    Post subject: [SOLVED]Is Ofast dangerous? Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54244
Location: 56N 3W

PostPosted: Tue Apr 24, 2018 3:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Wed Apr 25, 2018 1:40 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum