Re: const versus __attribute__((const))

Arnd Bergmann
2003-12-09T11:59:31Z

On Tuesday 09 December 2003 08:40, H. Peter Anvin wrote:
> Well, I get no warning from the following code, with gcc 3.2.2 and -W
> -Wall:
>
> int foo(int x)
> {
>    int y, z, w;
>
>    asm("movl %1,%0" : "=r" (y) : "r" (x));
>    asm("movl %1,%0" : "=r" (z) : "m" (y+1));
>    asm("movl %1,%0" : "=r" (w) : "m" (33));
>
>    return z+w;
> }

For reference, both gcc-3.3 and gcc-3.4 (snapshot) give produce the same assembly
as gcc-3.2 for your code, but give this warning:

test.c:6: warning: use of memory input without lvalue in asm operand 1 is deprecated
test.c:7: warning: use of memory input without lvalue in asm operand 1 is deprecated