Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc -O4 optimization flag

What's the meaning of the -O4 optimization flag in gcc (3.2.3)? What's the difference to O3? When would you use one vs. the other?

The man pages only mention O, O0-3, Os, no word of the mysterious O4. Thanks!

like image 411
naumcho Avatar asked Aug 03 '10 18:08

naumcho


People also ask

What is optimization flag in GCC?

Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. The compiler performs optimization based on the knowledge it has of the program.

What is default GCC optimization level?

GCC has a range of optimization levels, plus individual options to enable or disable particular optimizations. The overall compiler optimization level is controlled by the command line option -On, where n is the required optimization level, as follows: -O0 . (default).

What does flag in GCC do?

gcc -c compiles source files without linking.

How do I disable GCC optimization?

The gcc option -O enables different levels of optimization. Use -O0 to disable them and use -S to output assembly. -O3 is the highest level of optimization.


1 Answers

There is no -O4 in 3.2.3. Everything above -O3 results in -O3 being chosen.

like image 88
tstenner Avatar answered Sep 17 '22 22:09

tstenner