<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 31, 2015 at 9:39 AM, Tobias Grosser <span dir="ltr"><<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 08/31/2015 06:04 PM, David Blaikie wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, Aug 30, 2015 at 12:51 PM, Tobias Grosser via llvm-commits <<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: grosser<br>
Date: Sun Aug 30 14:51:01 2015<br>
New Revision: 246396<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=246396&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=246396&view=rev</a><br>
Log:<br>
Do not store into a temporary twine<br>
<br>
For some reason, this causes memory corruption issues. Let's just avoid it.<br>
<br>
</blockquote>
<br>
Twines are not designed to be named, as such.<br>
<br>
A Twine expresion stores references to Twine subexpressions that are local<br>
to the C++ full expression - once you are outside that full expression<br>
those references are dangling (as the subexpression Twines are out of<br>
scope).<br>
</blockquote>
<br></span>
Thanks for explaining. I think I run into a similar issue a couple of months<br>
ago. Unfortunately the code that showed the bug does not really give any hint<br>
that this is indeed problematic:<span class=""><br>
<br>
auto Name = Address->getName() + ".reload";<br>
<br></span>
I suppose there is no easy way for us to make this cause a compiler bug or<br>
trigger an assert?<br></blockquote><div><br></div><div>Not really, no. UBSan could do some lifetime management checking, but even that's pretty tricky.<br><br>Maybe ASan's (or MSan, is it?) stack lifetime checkers? (I forget what they're called, but I think there's some prototype support for this... )</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Best,<br>
Tobias<br>
<br>
</blockquote></div><br></div></div>