-O vs -O2: Opinions Please

I have always used CFLAGS= -O.

I read somewhere that the FBSD team thinks there might be possible problems in floating point if -O2 is used, and that is why I have always used -O (and -pipe). Stability is much more important to me that anything else.

Do you other FreeBSD people use -O2 without any problems. I have read that you do not want to do this on the kernel, and I am pretty sure it defaults to that, but what about the ports?

Now, I am doing this on a pentium4 which means the compiler might be more mature??????????

I would really appreciate your opinions on this. I'm compiling the 7-1 kernel as I type this and might try -O2 for the ports.
 
&quot said:
.if defined(%POSIX)
CC ?= c89
CFLAGS ?= -O
.else
CC ?= cc
.if ${MACHINE_ARCH} == "arm"
CFLAGS ?= -O -fno-strict-aliasing -pipe
.else
CFLAGS ?= -O2 -fno-strict-aliasing -pipe
.endif
.endif

Those are the defaults, so even kernel will most likely use "-O2 -fno-strict-aliasing -pipe" if you don't change them. Looks safe enough if FreeBSD uses them by default, doesn't it?
 
Stick to the defaults
Otherwise use search to find out public opinion on changing defaults cflags in FreeBSD!!!


all you want to change is
CPUTYPE?=
flag

for pentium4 it might be pentium4, pentium4e or prescott
pentium4 is safe
 
I did not know that.

Andrius said:
Those are the defaults, so even kernel will most likely use "-O2 -fno-strict-aliasing -pipe" if you don't change them. Looks safe enough if FreeBSD uses them by default, doesn't it?



Thank you. I did not know that.
 
Thank you Too

killasmurf86 said:
Stick to the faults
Otherwise use search to find out public opinion on changing defaults cflags in FreeBSD!!!


all you want to change is
CPUTYPE?=
flag

for pentium4 it might be pentium4, pentium4e or prescott
pentium4 is safe


Hmmmmm. So don't even set CFLAGS unless you have a reason to. Dang. All my old packages are CFLAGS= -O -pipe.

I have read public opinion; lots of it. I don't know' it is said that the difference between -O and -O2 is negligiable.

I'm not even going to set CFLAGS anymore unless I have a good reason. Thanks.
 
I experimented A LOT with CFLAGS. I dug really deep into the gcc documentation and tried and benchmarked a lot.

After all this testing it is my solemn conviction that the defaults are just fine and deviating from them is not worth the trouble.
 
kamikaze said:
I experimented A LOT with CFLAGS. I dug really deep into the gcc documentation and tried and benchmarked a lot.

After all this testing it is my solemn conviction that the defaults are just fine and deviating from them is not worth the trouble.
Same here. -O2 is definately where the sweet spot is. -O3 tends to somewhat faster depending on the kind of program and programmer ;) OTH, -O is noticbly slower than -O2 in many cases.
 
Back
Top