Merge from mainline.
[official-gcc.git] / gcc / testsuite / gcc.dg / reg-vol-struct-1.c
blob7751bb4a117113de15ee77d93f1b25e9b022c734
1 /* Test cases of structures with volatile fields declared register:
2 should be allowed unless register name given but explicitly taking
3 the address forbidden. */
4 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
6 /* { dg-do compile } */
8 struct S { volatile int field; };
10 void
11 f (void)
13 register struct S a;
14 register struct S b[2];
15 register struct S c __asm__("nosuchreg"); /* { dg-error "object with volatile field" "explicit reg name" } */
16 &a; /* { dg-warning "address of register" "explicit address" } */
17 b; /* { dg-warning "address of register" "implicit address" } */