Hi, On Mon, 28 Aug 2017, Jeff Law wrote:
> > long a, b = 0; > > asm ("" : "=r" (a) : "0" (0)); > I wouldn't use a matching constraint here. Something like this is > probably closer to what you want: > > asm ("" : "=r" (a) : "n" (0)); > > The "n" says accept any immediate integer constant with a compile time > known value. > > In fact, I could probably argue that "0" (0) should generate an error as > a constraint -- it's meaningless in that you can't match a constant > integer input to any output. Huh? No. The semantics are perfectly valid for this. It says "put the output into a register, place that into variable 'a', put the input value into the same register". Value is just that, an arbitrary rvalue (of correct type of course). We accept any expression forms, as we should, including constants. FWIW, the above is a "portable" way to get the value 0 into 'a' without the compiler knowing. Ciao, Michael.