<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Yaron,<br>
Yes I meant double destruction.<br>
Vassil<br>
On 03/08/14 20:08, Yaron Keren wrote:<br>
</div>
<blockquote
cite="mid:CANa4zJpgvvYJj1zN9b0+T7aTp3e0_wuMXGrE3a1ramfpDWS+Lg@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="rtl">
<div dir="ltr">Hi Vassil,</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Do you mean double destruction (not deletion) of <span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">MacroInfo
first time in </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">ReleaseMacroInfo </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">and
the second time in </span>~Preprocessor via
~MacroInfoChain?</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">
<div dir="ltr"> while (MacroInfoChain *I = MIChainHead) {</div>
<div dir="ltr"> MIChainHead = I->Next;</div>
<div dir="ltr"> I->~MacroInfoChain();</div>
<div dir="ltr"> }</div>
<div><br>
</div>
<div>or something else?</div>
<div><br>
</div>
<div>Yaron<br>
</div>
</div>
<div dir="ltr"><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div dir="ltr">2014-08-02 23:05 GMT+03:00 Vassil Vassilev <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:vvasilev@cern.ch" target="_blank">vvasilev@cern.ch</a>></span>:</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
In cases where ReleaseMacroInfo gets called and it doesn't
cleanup the Preprocessor's MIChainHead can lead to double
deletion. I am sending the patch that fixes the problem for
me.<br>
Vassil<br>
<br>
<br>
diff --git a/lib/Lex/PPDirectives.cpp
b/lib/Lex/PPDirectives.cpp<br>
index 5f38387..1a9b5eb 100644<br>
--- a/lib/Lex/PPDirectives.cpp<br>
+++ b/lib/Lex/PPDirectives.cpp<br>
@@ -94,6 +94,14 @@ Preprocessor::AllocateVisibilityMacroDirective(SourceLocation
Loc,<br>
/// error in the macro definition.<br>
void Preprocessor::ReleaseMacroInfo(MacroInfo *MI) {<br>
// Don't try to reuse the storage; this only happens on
error paths.<br>
+<br>
+ // If this is on the macro info chain, avoid double
deletion on teardown.<br>
+ while (MacroInfoChain *I = MIChainHead) {<br>
+ if (&(I->MI) == MI)<br>
+ I->Next = (I->Next) ? I->Next->Next : 0;<br>
+ MIChainHead = I->Next;<br>
+ }<br>
+<br>
MI->~MacroInfo();<br>
}<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a moz-do-not-send="true"
href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a moz-do-not-send="true"
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>
</div>
</blockquote>
<br>
</body>
</html>