error: matching constraint references invalid operand number

rempas rempas at tutanota.com
Fri Mar 4 17:18:56 UTC 2022


Hello! After I've been convinced on using, GDC as my go to 
compiler when I need optimization (or other than x86_x64 targets) 
thanks to the replays of my previous posts, I now try to compiler 
my project using GDC but I'm having an error. I'm trying to use 
inline assembly (GCC syntax) but it won't compile (compiled 
without any problems with LDC). The inline assembly block 
specifically is part of the following function:

```d
i32 sys_clock_nanosleep(clock_id clock, i32 flags, timespec* req, 
timespec* rem) {
   i32 ret_code;

   asm {
     "syscall"
     : "=a" (ret_code)
     : "a" (230), "D" (clock), "S" (flags), "d" (req), "r10" (rem)
     : "memory", "rcx", "r11";
   }

   return ret_code;
}
```

When I try to compile, I'm getting the following error message:

```
source/time.d: In function ‘sys_clock_nanosleep’:
source/time.d:132:31: error: matching constraint references 
invalid operand number
   132 |       : "memory", "rcx", "r11";
```

Any ideas?


More information about the D.gnu mailing list