https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118940
Bug ID: 118940
Summary: [x86] inline assembly fails with 'asm' operand has
impossible constraints or there are not enough
registers
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: shankerwangmiao at gmail dot com
Target Milestone: ---
Created attachment 60532
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60532&action=edit
The code failed to compile with gcc-15
GCC 15 fails to compile [ipxe](https://ipxe.org). The error happens on handling
the inline assembly code included by src/tests/bigint_test.c, reporting that
'asm' operand has impossible constraints or there are not enough registers.
However, GCC 14 can successfully compile the code.
I tried to simplify the case, and I finally get the attached C code. The code
fails to compile using the command:
gcc -Wall -Wextra -g -Os -march=i386 -mregparm=3 -m32 -fno-PIE -c src.c -o
/dev/null
The symptom can be reproduced on godbolt: https://godbolt.org/z/MbjMc3TKc
I did a bisect on the gcc code, and found out that the compilation can succeed
before the commit a3f03891065c ("Relax ix86_hardreg_mov_ok after split1.").
I'm not familiar with GCC and I have no idea whether it is a code issue of a
compiler bug.