Debian Codegraph @

gcc/testsuite/c-c++-common/toplevel-asm-2.c

raw
1 /* PR c/41045 */
2 /* { dg-do compile } */
3 /* { dg-options "-O0" } */
4 /* { dg-additional-options "-fno-pie" { target pie } } */
5
6 int v[42], w[42], x;
7 void l1 (void);
8
9 asm ("# %0" : "=m" (32)); /* { dg-error "lvalue required in 'asm' statement" } */
10 asm ("# %0" : "=m" (v) : "0" (v)); /* { dg-warning "matching constraint does not allow a register" } */
11 asm ("# %0" : : "m" (v), "0" (v)); /* { dg-error "matching constraint references invalid operand number" } */
12 asm ("# %0" :: "i" (0) : "cc"); /* { dg-error "expected '\\\)' before ':' token" } */
13 asm ("# %0" : : "i" (0) :: l1); /* { dg-error "expected '\\\)' before '::?' token" } */
14 asm ("# %0" : "=r" (x)); /* { dg-error "constraint allows registers outside of a function" } */
15 asm ("# %0" : "=m" (x++)); /* { dg-error "lvalue required in 'asm' statement" } */
16 asm ("# %0" : "=m" (v[x])); /* { dg-error "output operand outside of a function is not constant" } */
17 asm ("# %0" :: "r" (x)); /* { dg-error "constraint allows registers outside of a function" } */
18 asm ("# %0" : : "m" (x++)); /* { dg-error "side-effects in input operand outside of a function" } */
19 asm ("# %0" : : "m" (v[x])); /* { dg-error "input operand outside of a function is not constant" } */
20 asm ("# %0" : : "i" (v[x])); /* { dg-error "input operand outside of a function is not constant" } */
21 asm ("# %0" : : "i" (x++)); /* { dg-error "side-effects in input operand outside of a function" } */