brintos

brintos / llvm-project-archived public Read only

0
0
Text · 888 B · 5f9ab58 Raw
37 lines · c
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 %s2 3// No crash for the following examples, where GNU Statement Expression extension4// could introduce region terminators (break, goto etc) before implicit5// initializers in a struct or an array.6// See https://github.com/llvm/llvm-project/pull/895647 8struct Foo {9  int field1;10  int field2;11};12 13void f1(void) {14  struct Foo foo = {15    .field1 = ({16      switch (0) {17      case 0:18        break; // A region terminator19      }20      0;21    }),22    // ImplicitValueInitExpr introduced here for .field223  };24}25 26void f2(void) {27  int arr[3] = {28    [0] = ({29        goto L0; // A region terminator30L0:31      0;32    }),33    // ImplicitValueInitExpr introduced here for subscript [1]34    [2] = 0,35  };36}37