[cfe-commits] r153067 - in /cfe/trunk: lib/Analysis/CFG.cpp test/SemaCXX/warn-everthing.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 19 16:48:42 PDT 2012
Author: kremenek
Date: Mon Mar 19 18:48:41 2012
New Revision: 153067
URL: http://llvm.org/viewvc/llvm-project?rev=153067&view=rev
Log:
Fix crash when querying the CFG reported when using the thread safety analysis
on code using multi-dimensional arrays. Fix by DeLesley Hutchins, and reported in
PR 12271.
Added:
cfe/trunk/test/SemaCXX/warn-everthing.cpp
Modified:
cfe/trunk/lib/Analysis/CFG.cpp
Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=153067&r1=153066&r2=153067&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Mon Mar 19 18:48:41 2012
@@ -3087,7 +3087,7 @@
const VarDecl *var = cast<CFGAutomaticObjDtor>(this)->getVarDecl();
QualType ty = var->getType();
ty = ty.getNonReferenceType();
- if (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
+ while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
ty = arrayType->getElementType();
}
const RecordType *recordType = ty->getAs<RecordType>();
Added: cfe/trunk/test/SemaCXX/warn-everthing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-everthing.cpp?rev=153067&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-everthing.cpp (added)
+++ cfe/trunk/test/SemaCXX/warn-everthing.cpp Mon Mar 19 18:48:41 2012
@@ -0,0 +1,13 @@
+// RUN: %clang -Weverything -fsyntax-only %s -verify
+
+// This previously crashed due to a bug in the CFG. Exercising all
+// warnings helps check CFG construction.
+class PR12271 {
+public:
+ PR12271();
+ ~PR12271();
+};
+
+void testPR12271() {
+ PR12271 a[1][1];
+}
\ No newline at end of file
More information about the cfe-commits
mailing list