[cfe-commits] r74664 - in /cfe/trunk: lib/Frontend/PCHReaderStmt.cpp lib/Frontend/PCHWriterStmt.cpp test/PCH/pr4489.c
Douglas Gregor
dgregor at apple.com
Wed Jul 1 16:29:14 PDT 2009
Author: dgregor
Date: Wed Jul 1 18:29:14 2009
New Revision: 74664
URL: http://llvm.org/viewvc/llvm-project?rev=74664&view=rev
Log:
Fix PR 4489, a PCH crash during de-serialization.
Added:
cfe/trunk/test/PCH/pr4489.c
Modified:
cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
cfe/trunk/lib/Frontend/PCHWriterStmt.cpp
Modified: cfe/trunk/lib/Frontend/PCHReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderStmt.cpp?rev=74664&r1=74663&r2=74664&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderStmt.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderStmt.cpp Wed Jul 1 18:29:14 2009
@@ -1133,6 +1133,5 @@
StmtStack.push_back(S);
}
assert(StmtStack.size() == 1 && "Extra expressions on stack!");
- SwitchCaseStmts.clear();
return StmtStack.back();
}
Modified: cfe/trunk/lib/Frontend/PCHWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterStmt.cpp?rev=74664&r1=74663&r2=74664&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterStmt.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterStmt.cpp Wed Jul 1 18:29:14 2009
@@ -826,5 +826,4 @@
}
StmtsToEmit.clear();
- SwitchCaseIDs.clear();
}
Added: cfe/trunk/test/PCH/pr4489.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/pr4489.c?rev=74664&view=auto
==============================================================================
--- cfe/trunk/test/PCH/pr4489.c (added)
+++ cfe/trunk/test/PCH/pr4489.c Wed Jul 1 18:29:14 2009
@@ -0,0 +1,20 @@
+// RUN: clang -x c-header -o %t.pch %s &&
+// RUN: clang -include %t -x c /dev/null -emit-llvm -S -o -
+// PR 4489: Crash with PCH
+
+typedef struct _IO_FILE FILE;
+extern int fprintf (struct _IO_FILE *__restrict __stream,
+ __const char *__restrict __format, ...);
+
+int x(void)
+{
+ switch (1) {
+ case 2: ;
+ int y = 0;
+ }
+}
+
+void y(void) {
+ extern char z;
+ fprintf (0, "a");
+}
\ No newline at end of file
More information about the cfe-commits
mailing list