Constraint for inline assembly with one register used for both an input variable and an output variable

LIU Hao lh_mouse@126.com
Fri Jun 6 09:16:05 GMT 2025


在 2025-6-6 17:11, Xi Ruoyao 写道:
> <source>:7:41: error: invalid input constraint '0' in asm
>      7 |     __asm__ volatile ("nop" : "+r"(t) : "0"(old));
>        |

This is equivalent to

    __asm__ volatile ("nop" : "=r"(t) : "0"(t), "0"(old));

  where the error is obvious.   ---------^-------^


-- 
Best regards,
LIU Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20250606/8de5050e/attachment.sig>


More information about the Gcc-help mailing list