aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr119537-2.c
blob: 7d65672448ac317edf0131ccf084775ef0d70b74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* PR middle-end/119537 */
/* { dg-do compile } */
/* { dg-options "-O2" } */

volatile int v;
void *bar (void *, void *);

void
foo (bool z)
{
  if (z)
    goto *&&x;				/* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
					/* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */
  [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */
					/* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */
					/* { dg-message "enters statement expression" "" { target c++ } .-2 } */
  [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */
					/* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */
  goto *bar (&&x, &&y);			/* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */
					/* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */
					/* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */
					/* { dg-message "enters statement expression" "" { target c++ } .-3 } */
}