gcc/testsuite/gcc.dg/c23-labels-1.c
raw| 1 | /* Tests for labels before declarations and at ends of compound statements. */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 | |
| 5 | int f(int x) |
| 6 | { |
| 7 | goto b; |
| 8 | a: int i = 2 * x; |
| 9 | aa: int u = 0; int v = 0; |
| 10 | goto c; |
| 11 | b: goto a; |
| 12 | { i *= 3; c: } |
| 13 | return i + u + v; |
| 14 | d: |
| 15 | } |
| 16 | |
| 17 | int main(void) |
| 18 | { |
| 19 | if (2 != f(1)) |
| 20 | __builtin_abort(); |
| 21 | |
| 22 | return 0; |
| 23 | } |