<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 Oct 17, 2012, at 7:34 AM, Kostya Serebryany <<a href="mailto:kcc@google.com">kcc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Hello, </span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I've recently changed AddressSanitizer (asan) compiler pass from ModulePass to FunctionPass and it could a bit of mayhem. </div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
The problem is that asan FunctionPass instruments a function foo, then foo gets inlined into bar, then bar gets instrumented</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
and thus the code of foo gets instrumented twice (which causes run-time crash).</div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); position: static; z-index: auto; ">This happens only at -O0; at -O1 we get the correct order of events for some reason (foo gets inlined, then foo and bar are instrumented). </div></blockquote><div><br></div><div>I'm not sure what the difference here is between -O0 and -O1, but this *is* intended behavior.  This "interlacing" of passes is really important for C++ optimization (among other things) where optimizing a function can dramatically shrink it (due to abstraction penalties being removed)… which then makes it a much strongly inline candidate.</div><div><br></div><div>-Chris</div></div></body></html>