This flag fill improve the quality of asan warning messages. <div>Compare the asan output for a test program at O0 and O1: </div><div><div><br></div><div>---------------------------------------------------------</div><div>
int global[10];</div><div>void call4(int i) { global[i+10]++; }</div><div>void call3(int i) { call4(i); }</div><div>void call2(int i) { call3(i); }</div><div>void call1(int i) { call2(i); }</div><div>int main(int argc, char **argv) {</div>
<div> call1(argc);</div><div> return global[0];</div><div>}</div></div><div>---------------------------------------------------------</div><div>O0: </div><div><div>READ of size 4 at 0x00000061416c thread T0</div><div> #0 0x404183 in call4(int) deep_tail_call.cc:2</div>
<div> #1 0x404262 in call3(int) deep_tail_call.cc:3</div><div> #2 0x4043c2 in call2(int) deep_tail_call.cc:4</div><div> #3 0x404522 in call1(int) deep_tail_call.cc:5</div><div> #4 0x404724 in main deep_tail_call.cc:7</div>
</div><div>O1: </div><div><div>READ of size 4 at 0x00000061316c thread T0</div><div> #0 0x403fee in call4(int) deep_tail_call.cc:2</div></div><div><br></div><div>I am not sure if this flag should be set by default when asan is on. </div>
<div>There are at least two other flags that are required to get perfect call stacks (-fno-inline or -O1; -fno-omit-frame-pointer).</div><div>We should either enable all of them under asan, or none. </div><div>I prefer to not change these flag under the hood, but instead document that they are required for more informative warning messages (at the cost of some performance loss). </div>
<div><br></div><div>--kcc </div><div><br></div><div><br><div class="gmail_quote">On Wed, Jan 18, 2012 at 7:54 PM, Nick Lewycky <span dir="ltr"><<a href="mailto:nlewycky@google.com">nlewycky@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch adds support for the -fno-optimize-sibling-calls flag. The driver lowers -fno-optimize-sibling-calls to -mdisable-tail-calls and cc1 will ask llvm to not do any tail/sibling call optimization in the codegen layer. Thus far this is only implemented in LLVM's x86 backend.<div>
<br></div><div>The goal is to produce better ASAN reports by preserving correct call stacks, though I don't enable it by default with -faddress-sanitizer. Maybe the ASAN folks will want to add that after this lands, I leave it to them.<div>
<br></div><div>Please review!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Nick</div><div><br></div></font></span></div>
<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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>