summaryrefslogtreecommitdiff
path: root/test/Analysis/cast-to-struct.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/cast-to-struct.cpp')
-rw-r--r--test/Analysis/cast-to-struct.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/Analysis/cast-to-struct.cpp b/test/Analysis/cast-to-struct.cpp
index 45d55947c9377..c3aba023c56e4 100644
--- a/test/Analysis/cast-to-struct.cpp
+++ b/test/Analysis/cast-to-struct.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.core.CastToStruct,core -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.core.CastToStruct,core -verify %s
struct AB {
int A;
@@ -65,3 +65,17 @@ void intToStruct(int *P) {
void *VP = P;
Abc = (struct ABC *)VP;
}
+
+// https://llvm.org/bugs/show_bug.cgi?id=31173
+void dontCrash1(struct AB X) {
+ struct UndefS *S = (struct UndefS *)&X;
+}
+
+struct S;
+struct T {
+ struct S *P;
+};
+extern struct S Var1, Var2;
+void dontCrash2() {
+ ((struct T *) &Var1)->P = &Var2;
+}