Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 1 | // RUN: clang -x c-header -o %t.pch %s |
| 2 | // RUN: echo > %t.empty.c |
Daniel Dunbar | e584b65 | 2009-11-03 17:56:18 +0000 | [diff] [blame] | 3 | // RUN: clang -include %t -x c %t.empty.c -emit-llvm -S -o - |
Douglas Gregor | ae4df62 | 2009-07-01 23:29:14 +0000 | [diff] [blame] | 4 | // PR 4489: Crash with PCH |
Douglas Gregor | c29f77b | 2009-07-07 16:35:42 +0000 | [diff] [blame] | 5 | // PR 4492: Crash with PCH (round two) |
| 6 | // PR 4509: Crash with PCH (round three) |
Douglas Gregor | ae4df62 | 2009-07-01 23:29:14 +0000 | [diff] [blame] | 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"); |
Douglas Gregor | d89275b | 2009-07-06 18:54:52 +0000 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | struct y0 { int i; } y0[1] = {}; |
| 25 | |
| 26 | void x0(void) |
| 27 | { |
| 28 | extern char z0; |
| 29 | fprintf (0, "a"); |
Douglas Gregor | c29f77b | 2009-07-07 16:35:42 +0000 | [diff] [blame] | 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"); |
Daniel Dunbar | e584b65 | 2009-11-03 17:56:18 +0000 | [diff] [blame] | 41 | } |