<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 6, 2013, at 5:07 PM, Anna Zaks <<a href="mailto:ganna@apple.com">ganna@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Attached is a new patch, which uses GDM to store the VarDecls of globals previously initialized along the path.</div><div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br></div><div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Thanks for the suggestion,</div><div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Anna.</div></blockquote></div><br><div>Thanks Anna. Looks like the right approach, but this looks suspicious:</div><div><br></div><div><div>+ const VarDecl *VD = dyn_cast<VarDecl>(D);</div><div>+</div><div>+ if (!D || !VD) {</div><div> //TODO:AZ: remove explicit insertion after refactoring is done.</div><div> Dst.insert(Pred);</div><div> return;</div><div> }</div></div><div><br></div><div><br></div><div>If 'D' can be null, then the dyn_cast<> can crash. The safe code would be:</div><div><br></div><div>const VarDecl *VD = dyn_cast_or_null<VarDecl>(D);</div><div>if (!VD) {</div><div> …</div><div>}</div><div><br></div><div><br></div></body></html>