Strange optimisation problem - gcc 4.3.2

Andrew Haley aph@redhat.com
Thu Nov 12 10:27:00 GMT 2009


Mark Cave-Ayland wrote:

> So I'm really confused as to how adding a simply function pointer in the 
> global declaration section (without even adding any code to reference 
> it) suddenly incurs an extra 40% overhead? Can anyone explain why this 
> is, and/or point me to any suitable gcc optimisation guides?

There are a few possibilities, such as changing the alignment of the data,
but without seeing the code it's hard to say.

> For reference, the gcc compiler is gcc 4.3.2 under Debian Lenny and the 
> compile flags are:
> 
> -Os -g -Wall -Wredundant-decls -Wshadow -Wpointer-arith
> -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels 
> -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes

We don't really have enough information.  If you could provide the code
so that we can try it, we could help.

Andrew.



More information about the Gcc mailing list