<div class="gmail_quote">On Mon, Mar 19, 2012 at 4:48 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: kremenek<br>
Date: Mon Mar 19 18:48:41 2012<br>
New Revision: 153067<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=153067&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=153067&view=rev</a><br>
Log:<br>
Fix crash when querying the CFG reported when using the thread safety analysis<br>
on code using multi-dimensional arrays.  Fix by DeLesley Hutchins, and reported in<br>
PR 12271.<br>
<br>
Added:<br>
    cfe/trunk/test/SemaCXX/warn-everthing.cpp<br>
Modified:<br>
    cfe/trunk/lib/Analysis/CFG.cpp<br>
<br>
Modified: cfe/trunk/lib/Analysis/CFG.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=153067&r1=153066&r2=153067&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=153067&r1=153066&r2=153067&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Analysis/CFG.cpp (original)<br>
+++ cfe/trunk/lib/Analysis/CFG.cpp Mon Mar 19 18:48:41 2012<br>
@@ -3087,7 +3087,7 @@<br>
       const VarDecl *var = cast<CFGAutomaticObjDtor>(this)->getVarDecl();<br>
       QualType ty = var->getType();<br>
       ty = ty.getNonReferenceType();<br>
-      if (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {<br>
+      while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {<br>
         ty = arrayType->getElementType();<br>
       }<br></blockquote><div><br></div><div>This can be expressed more directly as:</div><div><br></div><div>ty = astContext.getBaseElementTy(ty);</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

       const RecordType *recordType = ty->getAs<RecordType>();<br>
<br>
Added: cfe/trunk/test/SemaCXX/warn-everthing.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-everthing.cpp?rev=153067&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-everthing.cpp?rev=153067&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/SemaCXX/warn-everthing.cpp (added)<br>
+++ cfe/trunk/test/SemaCXX/warn-everthing.cpp Mon Mar 19 18:48:41 2012<br>
@@ -0,0 +1,13 @@<br>
+// RUN: %clang -Weverything -fsyntax-only %s -verify<br>
+<br>
+// This previously crashed due to a bug in the CFG.  Exercising all<br>
+// warnings helps check CFG construction.<br>
+class PR12271 {<br>
+public:<br>
+  PR12271();<br>
+  ~PR12271();<br>
+};<br>
+<br>
+void testPR12271() {<br>
+  PR12271 a[1][1];<br>
+}<br>
\ No newline at end of file<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br>