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