Josà Luis GarcÃa Pallero <jgpallero@xxxxxxxxx> writes: > Using the -On optimization flag, what is the greatest "n" value that > can I use? In the gcc manual (4.5.1, 4.4.5, 3.4.6) the greatest level > documented is -O3 > (http://gcc.gnu.org/onlinedocs/gcc-4.5.1/gcc/Optimize-Options.html#Optimize-Options), > but if you tray for example with -O4, -O5, -O9, etc. no warning nor > error is emitted. I've asket some people and all says that -O4 and -O5 > are valid and higher level optimizators than the documented -O3. > What is the correct answer? Is -O3 the higher optimization level as is > documented in the manual or -O4, -O5 performs additional > optimizations? In current gcc values greater than -O3 are equivalent to -O3. > If -O3 is the higher why the use of -O4, -O5 not emits > a warning or error? If -O4 is ever defined, it will certainly include all the optimizations at -O3, so there is no particular reason to warn about using -O4 today. In practice I think -O3 is not all that useful. The distinction between -O1 and -O2 is reasonably clear: -O2 ignores compilation time and also enables strict adherence to language standards where that helps optimizations (-fstrict-aliasing, -fstrict-overflow). Going to -O3 enables more speculative optimizations, so in some cases code compiled with -O3 can be slower than code compiled with -O2. Mainline gcc introduces a -Ofast option, which enables -O3 plus disregarding language standards where that helps optimiations (basically, it enables -ffast-math). Ian