Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-fno-omit-frame-pointer without optimization

I was wondering what -fno-omit-frame-pointer will do without optimization?

CXXFLAGS = -Wall -ggdb3 -DDEBUG -fno-omit-frame-pointer

Isn't it that fomit-frame-pointer auto turned on at all levels of -O (except -O0)? I assume in my example it is -O0 by default.

Thanks and regards!

like image 519
Tim Avatar asked Aug 27 '09 12:08

Tim


People also ask

How do I disable optimization?

Use -O0 to disable them and use -S to output assembly. -O3 is the highest level of optimization. Starting with gcc 4.8 the optimization level -Og is available. It enables optimizations that do not interfere with debugging and is the recommended default for the standard edit-compile-debug cycle.

What is optimization in GCC?

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).


2 Answers

As you already imply yourself, -fno-omit-frame-pointer is just ignored in your case, as the frame pointer wouldn't be ommitted anyways in the default -O0.

like image 169
ypnos Avatar answered Oct 04 '22 09:10

ypnos


As I understand it Ox are just shortcuts for a set of optimization flags. The default optimization is zero, so using one flag without Ox, should do just that optimization.

In my opinion, omitting the frame pointer increases debugging difficulty for a modest performance gain.

like image 36
rpg Avatar answered Oct 04 '22 09:10

rpg