diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common/pr119537-1.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119537-1.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr119537-1.c b/gcc/testsuite/c-c++-common/pr119537-1.c new file mode 100644 index 0000000..7959826 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119537-1.c @@ -0,0 +1,23 @@ +/* PR middle-end/119537 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +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 } */ +} |