https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78091
Bug ID: 78091 Summary: i386: Register allocation failure with -Os Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: fw at gcc dot gnu.org Target Milestone: --- Target: i386 Created attachment 39874 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39874&action=edit posix_fallocate.i The attached test case has been extracted from this glibc bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=20729 We were under the impression that starting with GCC 5, we could issue six-argument system calls (which need all registers except %esp) directly from inline assembly. Usually, this works, but it's clear that register allocation is difficult under these circumstances. With “-m32 -Os”, the test case fails with: posix_fallocate.i: In function ‘posix_fallocate’: posix_fallocate.i:24:1: error: bp cannot be used in asm here } ^ posix_fallocate.i:24:1: error: bp cannot be used in asm here This happens with: gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC) gcc version 7.0.0 20160518 (experimental) (GCC) If this cannot be fixed in GCC itself, we need a reliable compile-time test to discover optimizer settings which cause this at configure time.