https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105413
Bug ID: 105413 Summary: gdc extended assembler cannot constraints r8 - r15 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: witold.baryluk+gcc at gmail dot com Target Milestone: --- gcc in C does not support directly register constraints for x86_64 registers r8 - r15. In C this can be done however using local register variables and asm attributes. https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html There is no way to use this in GDC extended assembler. version (linux) { version (GNU) { enum SYSCALL { OPENAT = 56, } @nogc: nothrow: size_t syscall(SYSCALL ident)(size_t arg1, size_t arg2, size_t arg3, size_t arg4) { version (X86_64) { asm @nogc nothrow { "syscall" // output: : "=a" (arg1) // inputs: : "a" (ident), // rax - syscall number "D" (arg1), // rdi - arg1 "S" (arg2), // rsi - arg2 "d" (arg3), // rdx - arg3 "r10" (arg4), // r10 - arg4 "m"( *cast(ubyte*)arg1) // "dummy" input instead of full memory clobber // clobers : "c", "r11"; // Clobers rax, and rcx and r11. } return arg1; } else { static assert(false, "This platform/architecture is not supported when using GDC compiler"); } } } private int openatdummy() @nogc nothrow { return cast(int)syscall!(SYSCALL.OPENAT)(0, 0, 0, 0); } } myio.d: In function ‘syscall’: myio.d:232:10: error: matching constraint references invalid operand number 232 | ; https://godbolt.org/z/xGzxa6orc