commit | cf715bd33006599db3b6d472bdf6bbe40a616dd0 | [log] [tgz] |
---|---|---|
author | Daniel Marjamaki <daniel.marjamaki@evidente.se> | Tue Mar 07 19:20:48 2017 +0000 |
committer | Daniel Marjamaki <daniel.marjamaki@evidente.se> | Tue Mar 07 19:20:48 2017 +0000 |
tree | 0adc143fc1eea7ade621bf7021409248f316a39f | |
parent | ac2b5767afb8362bd86a0cb73bb9b528097ca22f [diff] [blame] |
[analyzer] Fix crashes in CastToStruct checker for undefined structs This crash was reported in https://bugs.llvm.org//show_bug.cgi?id=31173 Differential Revision: https://reviews.llvm.org/D28297 llvm-svn: 297187
diff --git a/clang/test/Analysis/cast-to-struct.cpp b/clang/test/Analysis/cast-to-struct.cpp index 0a6b8ff..c3aba02 100644 --- a/clang/test/Analysis/cast-to-struct.cpp +++ b/clang/test/Analysis/cast-to-struct.cpp
@@ -65,3 +65,17 @@ 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; +}