| 1 | // RUN: %clang -x c-header -o %t.pch %s |
| 2 | // RUN: echo > %t.empty.c |
| 3 | // RUN: %clang -include %t -x c %t.empty.c -emit-llvm -S -o - |
| 4 | |
| 5 | // PR 4489: Crash with PCH |
| 6 | // PR 4492: Crash with PCH (round two) |
| 7 | // PR 4509: Crash with PCH (round three) |
| 8 | typedef struct _IO_FILE FILE; |
| 9 | extern int fprintf (struct _IO_FILE *__restrict __stream, |
| 10 | __const char *__restrict __format, ...); |
| 11 | |
| 12 | int x(void) |
| 13 | { |
| 14 | switch (1) { |
| 15 | case 2: ; |
| 16 | int y = 0; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | void y(void) { |
| 21 | extern char z; |
| 22 | fprintf (0, "a"); |
| 23 | } |
| 24 | |
| 25 | struct y0 { int i; } y0[1] = {}; |
| 26 | |
| 27 | void x0(void) |
| 28 | { |
| 29 | extern char z0; |
| 30 | fprintf (0, "a"); |
| 31 | } |
| 32 | |
| 33 | void x1(void) |
| 34 | { |
| 35 | fprintf (0, "asdf"); |
| 36 | } |
| 37 | |
| 38 | void y1(void) |
| 39 | { |
| 40 | extern char e; |
| 41 | fprintf (0, "asdf"); |
| 42 | } |
| 43 | |