<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 13, 2017 at 7:55 AM, Stephan Bergmann via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For a C++ program like<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
#include <new><br>
int main() {<br>
char * p1 = new char[sizeof (int)];<br>
int * p2 = new(p1) int;<br>
delete p2;<br>
}<br>
</blockquote>
<br>
compiling it with -fsanitize=address will somewhat unhelpfully report an "AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete)" failure.<br>
<br>
Is there a good way to work around that</blockquote><div><br></div><div>Why not use "delete [] p1"? </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> (in the program's source code), short of using the generic ASan facilities of suppressing or blacklisting code, or using ASAN_OPTIONS=alloc_dealloc_mis<wbr>match=0 to disable the check completely?<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>