Shih-wei Liao | f8fd82b | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 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 | // PR 4489: Crash with PCH |
| 5 | // PR 4492: Crash with PCH (round two) |
| 6 | // PR 4509: Crash with PCH (round three) |
| 7 | typedef struct _IO_FILE FILE; |
| 8 | extern int fprintf (struct _IO_FILE *__restrict __stream, |
| 9 | __const char *__restrict __format, ...); |
| 10 | |
| 11 | int x(void) |
| 12 | { |
| 13 | switch (1) { |
| 14 | case 2: ; |
| 15 | int y = 0; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | void y(void) { |
| 20 | extern char z; |
| 21 | fprintf (0, "a"); |
| 22 | } |
| 23 | |
| 24 | struct y0 { int i; } y0[1] = {}; |
| 25 | |
| 26 | void x0(void) |
| 27 | { |
| 28 | extern char z0; |
| 29 | fprintf (0, "a"); |
| 30 | } |
| 31 | |
| 32 | void x1(void) |
| 33 | { |
| 34 | fprintf (0, "asdf"); |
| 35 | } |
| 36 | |
| 37 | void y1(void) |
| 38 | { |
| 39 | extern char e; |
| 40 | fprintf (0, "asdf"); |
| 41 | } |