summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/reg-vol-struct-1.c
blob: b885f917946d764ed801ccda019a57e7400e1398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* Test cases of structures with volatile fields declared register:
   should be allowed unless register name given but explicitly taking
   the address forbidden.  */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */

/* { dg-do compile } */

struct S { volatile int field; };

void
f (void)
{
  register struct S a;
  register struct S b[2];
  register struct S c __asm__("nosuchreg"); /* { dg-error "object with volatile field" "explicit reg name" } */
  &a; /* { dg-error "address of register" "explicit address" } */
  b; /* { dg-error "address of register" "implicit address" } */
}