------- Comment #1 from pinskia at gcc dot gnu dot org 2008-01-19 12:04 ------- It is constant folded but not until after inlining. A simplier example is:
static inline int f(int a) { return a+2; } int g(int a) { const int b[] = {f(1), f(2), f(3) }; return b[a]; } int g1(int a) { const int b[] = {(1)+2, (2)+2, (3)+2 }; return b[a]; } ---- CUT ---- Where g and g1 could produce the same code if wanted to. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Component|c++ |tree-optimization Ever Confirmed|0 |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2008-01-19 12:04:07 date| | Summary|ldexp variants, folding |array constants after | |inlining and | |"staticification" http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34864