-Og changes on 4.7.3?

2013-05-12 Thread Gene Smith
Could the -Og patches for 4.8 be back-ported to 4.7.3? Or is there 
important 4.8 dependencies that would make this not practicable?


The patches to add -Og shown on gcc.patches list don't look extremely 
extensive.


This would be for personal use and not necessarily proposed for general 
release.


Thanks,

-gene



4.8.2 -Og vs. -O1

2013-06-30 Thread Gene Smith
I tried -Og optimization on a recent svn snapshot of 4.8 and don't see 
much difference in the code compared to -O1. If anything, at least for 
one case, -Og is actually less debuggable than -O1, e.g., for a simple 
buffer selection like this:


uint8_t* buffer;

if (condx == true)
buffer = buf1;  // buf1 is a static external buffer
else
buffer = buf2;  // buf2 is a static external buffer
uint8_t foo = buffer[1];

With -O1 there is assembly code associated with each buffer assignment 
statement. But with -Og there is no code under the first buffer = buf1 
with it all under the 2nd buffer = buf2.


So, with -Og, when stepping through the code with condx true, it appears 
that the wrong line is executing since the first buffer = buf1 has no 
code and never occurs. Of course, the result is still correct and is 
actually maybe more efficient or at least equal to the -O1 code, but 
there is no improved debug experience in this case.


In this case, the debug experience with -O1 is closer to -O0 than -Og is.

Also with -Og, some variables are still optimized away like -O1 and 
higher, but unlike -O0 where all variables are, of course, visible with 
the debugger (gdb).


-gene