<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 29, 2015 at 10:19 AM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@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: pete<br>
Date: Fri May 29 12:19:11 2015<br>
New Revision: 238579<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D238579-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ynpyJ1RNQLtvrKuV1iT_mRyiEQySIasmZc3Z56NB7uY&s=rnj50Luy_E9fzlZojYyIDoJNuxE3BXYhhTOYSRDl9mc&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=238579&view=rev</a><br>
Log:<br>
Fix crash in MCExpr::print.<br>
<br>
Symbols are no longer required to be named, but this leads to a crash here if an<br>
unnamed symbol checks that its first character is '$'.<br>
<br>
Change the code to first check for a name, then check its first character.<br>
<br>
No test case i'm afraid as this is debugging code, but any test case with temp labels<br>
and 'llc --debug --filetype=obj' would have crashed.<br></blockquote><div><br>I think I missed a step - why wouldn't we have a test that does that? (llc --debug --filetype=obj)?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/lib/MC/MCExpr.cpp<br>
<br>
Modified: llvm/trunk/lib/MC/MCExpr.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_MC_MCExpr.cpp-3Frev-3D238579-26r1-3D238578-26r2-3D238579-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ynpyJ1RNQLtvrKuV1iT_mRyiEQySIasmZc3Z56NB7uY&s=g2gHmfhQLFZ3A5AHlFVauiR4EML_w8geNz3bbg6dmAU&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=238579&r1=238578&r2=238579&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCExpr.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCExpr.cpp Fri May 29 12:19:11 2015<br>
@@ -43,7 +43,7 @@ void MCExpr::print(raw_ostream &OS) cons<br>
     const MCSymbol &Sym = SRE.getSymbol();<br>
     // Parenthesize names that start with $ so that they don't look like<br>
     // absolute names.<br>
-    bool UseParens = Sym.getName()[0] == '$';<br>
+    bool UseParens = !Sym.getName().empty() && Sym.getName()[0] == '$';<br>
     if (UseParens)<br>
       OS << '(' << Sym << ')';<br>
     else<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>