<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Thanks,<div>Fixed in <span style="font-family: Menlo; font-size: 11px;">r183455.</span></div><div><font face="Menlo" size="3"><br></font><div><div><div>On Jun 6, 2013, at 3:11 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline">On Jun 6, 2013, at 15:02 , Anna Zaks <<a href="mailto:ganna@apple.com">ganna@apple.com</a>> wrote:</div><br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: zaks<br>Date: Thu Jun 6 17:02:58 2013<br>New Revision: 183451<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=183451&view=rev">http://llvm.org/viewvc/llvm-project?rev=183451&view=rev</a><br>Log:<br>[analyzer] Ensure that pieces with invalid locations always get removed from the BugReport<br><br>The function in which we were doing it used to be conditionalized. Add a new unconditional<br>cleanup step.<br><br>This fixes PR16227 (<a href="radar://14073870">radar://14073870</a>) - a crash when generating html output for one of the test files.<br><br>Modified:<br> cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp<br> cfe/trunk/test/Analysis/unix-fns.c<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=183451&r1=183450&r2=183451&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=183451&r1=183450&r2=183451&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Thu Jun 6 17:02:58 2013<br>@@ -162,13 +162,6 @@ static bool removeUnneededCalls(PathPiec<br> IntrusiveRefCntPtr<PathDiagnosticPiece> piece(pieces.front());<br> pieces.pop_front();<br><br>- // Throw away pieces with invalid locations. Note that we can't throw away<br>- // calls just yet because they might have something interesting inside them.<br>- // If so, their locations will be adjusted as necessary later.<br>- if (piece->getKind() != PathDiagnosticPiece::Call &&<br>- piece->getLocation().asLocation().isInvalid())<br>- continue;<br>-<br> switch (piece->getKind()) {<br> case PathDiagnosticPiece::Call: {<br> PathDiagnosticCallPiece *call = cast<PathDiagnosticCallPiece>(piece);<br>@@ -218,8 +211,7 @@ static bool hasImplicitBody(const Decl *<br>}<br><br>/// Recursively scan through a path and make sure that all call pieces have<br>-/// valid locations. Note that all other pieces with invalid locations should<br>-/// have already been pruned out.<br>+/// valid locations.<span class="Apple-converted-space"> </span><br>static void adjustCallLocations(PathPieces &Pieces,<br> PathDiagnosticLocation *LastCallLocation = 0) {<br> for (PathPieces::iterator I = Pieces.begin(), E = Pieces.end(); I != E; ++I) {<br>@@ -252,6 +244,26 @@ static void adjustCallLocations(PathPiec<br> }<br>}<br><br>+/// Remove all pieces with invalid locations as these cannot be serialized.<br>+/// We might have pieces with invalid locations as a result of inlining Body<br>+/// Farm generated functions.<br>+static void removePiecesWithInvalidLocations(PathPieces &Pieces) {<br>+ for (PathPieces::iterator I = Pieces.begin(), E = Pieces.end(); I != E; ++I) {<br>+ if (PathDiagnosticCallPiece *C = dyn_cast<PathDiagnosticCallPiece>(*I))<br>+ removePiecesWithInvalidLocations(C->path);<br>+<br>+ if (PathDiagnosticMacroPiece *M = dyn_cast<PathDiagnosticMacroPiece>(*I))<br>+ removePiecesWithInvalidLocations(M->subPieces);<br>+<br>+ if (!(*I)->getLocation().isValid() ||<br>+ !(*I)->getLocation().asLocation().isValid()) {<br>+ Pieces.erase(I);<br></div></blockquote><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div dir="auto" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I is not valid after this erase(), so ++I could crash. The right thing to do here is "I = Pieces.erase(I)" (and then not increment I).</div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">+ continue;<br>+ }<br>+ <br>+ }<br>+}<br>+<br>//===----------------------------------------------------------------------===//<br>// PathDiagnosticBuilder and its associated routines and helper objects.<br>//===----------------------------------------------------------------------===//<br>@@ -3151,8 +3163,11 @@ bool GRBugReporter::generatePathDiagnost<br> (void)stillHasNotes;<br> }<br><br>+ // Redirect all call pieces to have valid locations.<br> adjustCallLocations(PD.getMutablePieces());<br><br>+ removePiecesWithInvalidLocations(PD.getMutablePieces());<br>+<br> if (ActiveScheme == PathDiagnosticConsumer::AlternateExtensive) {<br> SourceManager &SM = getSourceManager();<br><br><br>Modified: cfe/trunk/test/Analysis/unix-fns.c<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/unix-fns.c?rev=183451&r1=183450&r2=183451&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/unix-fns.c?rev=183451&r1=183450&r2=183451&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Analysis/unix-fns.c (original)<br>+++ cfe/trunk/test/Analysis/unix-fns.c Thu Jun 6 17:02:58 2013<br>@@ -1,6 +1,6 @@<br>// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,unix.API,osx.API %s -analyzer-store=region -analyzer-output=plist -analyzer-eagerly-assume -analyzer-config faux-bodies=true -analyzer-config path-diagnostics-alternate=false -fblocks -verify -o %t.plist<br>// RUN: FileCheck --input-file=%t.plist %s<br>-<br>+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.API,osx.API -analyzer-output=html -analyzer-config faux-bodies=true -fblocks -o %T/dir %s<br></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">This should use a variant on %t, not a subfolder in %T, so that the test's name is included in the temporary directory. We've used "%t.dir" before.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">struct _opaque_pthread_once_t {<br> long __sig;<br> char __opaque[8];<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">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div></blockquote></blockquote></div><br></div></div></body></html>