Debian Codegraph @

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

raw
1 /* PR c/41045 */
2 /* { dg-do compile } */
3 /* { dg-options "-O0" } */
4 /* { dg-additional-options "-fno-pie" { target pie } } */
5
6 extern int v[42];
7
8 asm ("# %0" : "=:" (32)); /* { dg-error "lvalue required in 'asm' statement" } */
9 /* { dg-error "':' constraint used for output operand" "" { target *-*-* } .-1 } */
10 asm ("# %0" : "=:" (v)); /* { dg-error "':' constraint used for output operand" } */
11 asm ("# %0" : : "i:" (v)); /* { dg-error "':' constraint mixed with other constraints" } */
12 asm ("# %0" : : ":i" (v)); /* { dg-error "':' constraint mixed with other constraints" } */
13 asm ("# %0" : : ",:" (v)); /* { dg-error "':' constraint mixed with other constraints" } */
14 asm ("# %0" : : ":,:" (v));
15 asm ("# %0" : : ":," (v)); /* { dg-error "':' constraint mixed with other constraints" } */
16 asm ("# %0" : : ":,,:" (v)); /* { dg-error "':' constraint mixed with other constraints" } */
17 asm ("" : : ":" (0)); /* { dg-error "constraint operand is not address of a function or non-automatic variable" } */
18
19 void
20 foo (int x)
21 {
22 int y;
23 l:;
24 asm ("" : : ":" (&x)); /* { dg-error "constraint operand is not address of a function or non-automatic variable" } */
25 asm ("" : : ":" (&&l)); /* { dg-error "constraint operand is not address of a function or non-automatic variable" } */
26 asm ("" : : ":" (&y)); /* { dg-error "constraint operand is not address of a function or non-automatic variable" } */
27 asm ("" : : ":" (0)); /* { dg-error "constraint operand is not address of a function or non-automatic variable" } */
28 }