error: matching constraint references invalid operand number

Iain Buclaw ibuclaw at gdcproject.org
Fri Mar 4 23:33:12 UTC 2022


On Friday, 4 March 2022 at 17:18:56 UTC, rempas wrote:
> 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?

GCC doesn't have constraints for registers %r8 .. %15.  As D 
doesn't have register variables either, you'll have to set-up r10 
in the instruction string.
```
asm {
   "mov %[rem], %%r10; syscall"
   : "=a" (ret_code)
   : "a" (230), "D" (clock), "S" (flags), "d" (req), [rem] "r" 
(rem)
   : "memory", "rcx", "r10", "r11";
}
```


More information about the D.gnu mailing list