https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62144
Bug ID: 62144 Summary: "Frame pointer required, but reserved" error with -fomit-frame-pointer but only with -m32 -O2 Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm Assignee: unassigned at gcc dot gnu.org Reporter: brooks at gcc dot gnu.org Created attachment 33328 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33328&action=edit (Example program) The following error is unexpected. We use -fomit-frame-pointer to allow us to reserve a register, but apparently it is required anyway -- but only when optimization is turned to -O2 and when compiled at -m32. $ cat t.i register int x0 asm ("bp"); static char x1[4096]; int strlen (char *); void x2 (); void x3 () { switch (0) case 0: x2 (0); int x4 = strlen (x1); if (x1[x4] == '\n') x2 (); } $ gcc-archive/trunk/213772/bin/gcc -c t.i -m32 -fomit-frame-pointer $ gcc-archive/trunk/213772/bin/gcc -c t.i -O1 -m32 -fomit-frame-pointer $ gcc-archive/trunk/213772/bin/gcc -c t.i -O2 -m32 -fomit-frame-pointer t.i: In function ‘x3’: t.i:6:1: error: frame pointer required, but reserved x3 () ^ t.i:1:14: note: for ‘x0’ register int x0 asm ("bp"); ^ $ Although the examples above use trunk, this also occurs with the 4.9 branch at the same revision.