blob: aaf5aac749e54dcc0e93ba211893117ce84710e5 [file] [log] [blame]
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00001// RUN: clang -x c-header -o %t.pch %s
2// RUN: echo > %t.empty.c
Daniel Dunbare584b652009-11-03 17:56:18 +00003// RUN: clang -include %t -x c %t.empty.c -emit-llvm -S -o -
Douglas Gregorae4df622009-07-01 23:29:14 +00004// PR 4489: Crash with PCH
Douglas Gregorc29f77b2009-07-07 16:35:42 +00005// PR 4492: Crash with PCH (round two)
6// PR 4509: Crash with PCH (round three)
Douglas Gregorae4df622009-07-01 23:29:14 +00007typedef struct _IO_FILE FILE;
8extern int fprintf (struct _IO_FILE *__restrict __stream,
9 __const char *__restrict __format, ...);
10
11int x(void)
12{
13 switch (1) {
14 case 2: ;
15 int y = 0;
16 }
17}
18
19void y(void) {
20 extern char z;
21 fprintf (0, "a");
Douglas Gregord89275b2009-07-06 18:54:52 +000022}
23
24struct y0 { int i; } y0[1] = {};
25
26void x0(void)
27{
28 extern char z0;
29 fprintf (0, "a");
Douglas Gregorc29f77b2009-07-07 16:35:42 +000030}
31
32void x1(void)
33{
34 fprintf (0, "asdf");
35}
36
37void y1(void)
38{
39 extern char e;
40 fprintf (0, "asdf");
Daniel Dunbare584b652009-11-03 17:56:18 +000041}