1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name statement-expression.c %s
2
3 // No crash for the following examples, where GNU Statement Expression extension
4 // could introduce region terminators (break, goto etc) before implicit
5 // initializers in a struct or an array.
6 // See https://github.com/llvm/llvm-project/pull/89564
7
8 struct Foo {
9 int field1;
10 int field2;
11 };
12
f1(void)13 void f1(void) {
14 struct Foo foo = {
15 .field1 = ({
16 switch (0) {
17 case 0:
18 break; // A region terminator
19 }
20 0;
21 }),
22 // ImplicitValueInitExpr introduced here for .field2
23 };
24 }
25
f2(void)26 void f2(void) {
27 int arr[3] = {
28 [0] = ({
29 goto L0; // A region terminator
30 L0:
31 0;
32 }),
33 // ImplicitValueInitExpr introduced here for subscript [1]
34 [2] = 0,
35 };
36 }
37