http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60877
Bug ID: 60877 Summary: __attribute__optimize("O0") conflict with static function at -O1 Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mnp at agtmt dot com Created attachment 32628 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32628&action=edit preprocessed .i file #include <stdio.h> static int sub1(int i, int j) { return j; } void __attribute__((optimize("O0"))) main(void) { int k; k = sub1(0, 1); printf("%d\n",k); } gcc -O1 if sub1() is static, return is wrong movl %edx, %eax ret if not static, return is correct movl 8(%esp), %eax ret gcc version 4.7.2 20130108 [gcc-4_7-branch revision 195012] (SUSE Linux)