1 /* PR c/48552 */
2 /* { dg-do compile } */
3 /* { dg-options "" } */
4
5 struct S;
6
7 void
f1(void * x)8 f1 (void *x)
9 {
10 __asm volatile ("" : : "r" (*x)); /* { dg-warning "dereferencing" "deref" } */
11 } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } 10 } */
12
13 void
f2(void * x)14 f2 (void *x)
15 {
16 __asm volatile ("" : "=r" (*x)); /* { dg-warning "dereferencing" "deref" } */
17 } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } 16 } */
18 /* { dg-error "invalid lvalue in asm output 0" "invalid lvalue" { target *-*-* } 16 } */
19 void
f3(void * x)20 f3 (void *x)
21 {
22 __asm volatile ("" : : "m" (*x)); /* { dg-warning "dereferencing" } */
23 }
24
25 void
f4(void * x)26 f4 (void *x)
27 {
28 __asm volatile ("" : "=m" (*x)); /* { dg-warning "dereferencing" } */
29 }
30
31 void
f5(void * x)32 f5 (void *x)
33 {
34 __asm volatile ("" : : "g" (*x)); /* { dg-warning "dereferencing" "deref" } */
35 } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } 34 } */
36
37 void
f6(void * x)38 f6 (void *x)
39 {
40 __asm volatile ("" : "=g" (*x)); /* { dg-warning "dereferencing" "deref" } */
41 } /* { dg-error "invalid use of void expression" "void expr" { target *-*-* } 40 } */
42 /* { dg-error "invalid lvalue in asm output 0" "invalid lvalue" { target *-*-* } 40 } */
43 void
f7(struct S * x)44 f7 (struct S *x)
45 {
46 __asm volatile ("" : : "r" (*x)); /* { dg-error "dereferencing pointer to incomplete type" } */
47 }
48
49 void
f8(struct S * x)50 f8 (struct S *x)
51 {
52 __asm volatile ("" : "=r" (*x)); /* { dg-error "dereferencing pointer to incomplete type" "incomplete" } */
53 } /* { dg-error "invalid lvalue in asm output 0" "invalid lvalue" { target *-*-* } 52 } */
54