GCC can't optimise this simple code: static const struct my_struct { int a; int b; } foo = { .a = 2, .b = 3};
int main(int argc, char **argv) { int volatile tmp; tmp = foo.a * foo.b; return 0; } GCC generates a "mul" opcode whereas every things are constant. -- Summary: CCP still doesn't look inside initializers for structures Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: franck dot bui-huu at innova-card dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20284