https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124074
Bug ID: 124074
Summary: [i386] mingw-w64 "'asm' operand has impossible
constraints" after enabling APX under
-fno-asynchronous-unwind-tables
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: thiago at kde dot org
Target Milestone: ---
Testcase:
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#define ARRAY_SIZE 3*10240
void testfunc(uint64_t* in, uint64_t* out, uint64_t** temp)
{
uint64_t* tempaddr[8];
for (int ii = 0; ii < 8; ++ii) {
tempaddr[ii] = NULL;
}
uint8_t skiplsd = rand() & 0x1;
asm volatile
( ""
:[SRC_PTR] "+r" (in), [DST_PTR] "+r" (out),
[TEMP_PTR1] "+r" (tempaddr[0]),
[TEMP_PTR2] "+r" (tempaddr[1]),
[TEMP_PTR3] "+r" (tempaddr[2]),
[TEMP_PTR4] "+r" (tempaddr[3]),
[TEMP_PTR5] "+r" (tempaddr[4]),
[TEMP_PTR6] "+r" (tempaddr[5]),
[TEMP_PTR7] "+r" (tempaddr[6]),
[TEMP_PTR8] "+r" (tempaddr[7])
:[SIZE] "i" (ARRAY_SIZE), [SKIPLSD] "g" (skiplsd)
:"rcx", "rbx", "rax", "r8", "memory", "cc"
);
}
Compile with:
x86_64-w64-mingw32ucrt-gcc -O2 -mapxf -fno-asynchronous-unwind-tables test.c
That results in:
test.c:17:5: error: 'asm' operand has impossible constraints or there are not
enough registers
17 | asm volatile
| ^~~
If you remove any of:
* -O2
* -mapxf
* -fno-asynchronous-unwind-tables
Or you compile for Linux, the above testcase compiles.
Given the need for -fno-asynchronous-unwind-tables, I'm guessing GCC is unable
to emit something relating to APX to the tables and thus gives up.