<div dir="ltr">I believe this is just because asan wasn't ported into the new PM until the clang 9 release which is why there's no asan instrumentation when using the new PM for older releases.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 3, 2020 at 11:47 AM Tobias Hieta via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">After experimenting a bit with godbolt it seems like asan is removed<br>
from the codegen when the new pass manager is used:<br>
<a href="https://godbolt.org/z/ccrMiN" rel="noreferrer" target="_blank">https://godbolt.org/z/ccrMiN</a><br>
<br>
But this also seems fixed if you switch to clang 9.0.0.<br>
<br>
On Mon, Feb 3, 2020 at 8:38 PM Tobias Hieta <<a href="mailto:tobias@plexapp.com" target="_blank">tobias@plexapp.com</a>> wrote:<br>
><br>
> Hello Alex,<br>
><br>
> Thanks for the hint. It was actually not the -O flag that created the<br>
> problem. But it pointed me in the right direction, when I passed<br>
> -fno-experimental-new-pass-manager it started to show the error. My<br>
> guess is that the new pass manager is more aggressive in removing UB?<br>
><br>
> Thanks,<br>
> Tobias<br>
><br>
> On Mon, Feb 3, 2020 at 5:29 PM Alex Brachet-Mialot<br>
> <<a href="mailto:alexbrachetmialot@gmail.com" target="_blank">alexbrachetmialot@gmail.com</a>> wrote:<br>
> ><br>
> > I haven’t looked at the code gen yet because I’m not on my computer right now but I suspect that at -Os the compiler is optimizing this away because it knows it to be undefined behavior. Try with -O0.<br>
> ><br>
> > On Mon, Feb 3, 2020 at 10:53 AM Tobias Hieta via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> >><br>
> >> Hello,<br>
> >><br>
> >> I am building sanitizers for our different platforms and trying to use<br>
> >> it in an example program, but while it seems like ASAN is running it's<br>
> >> init functions (see stdout below with ASAN_OPTIONS=verbosity=1) it<br>
> >> never catches anything in the program. This is LLVM 8.0.1 btw.<br>
> >><br>
> >> I was using this small test case:<br>
> >><br>
> >> int main(int argc, char** argv) {<br>
> >>   int *array = new int[100];<br>
> >>   delete [] array;<br>
> >>   return array[argc];  // BOOM<br>
> >> }<br>
> >><br>
> >> I am compiling with:<br>
> >><br>
> >><br>
> >> clang++ -resource-dir <path to sanitizers> -fsanitize=address<br>
> >> -shared-libasan -fno-omit-frame-pointer -Os -g -Wl,-rpath,<path to<br>
> >> sanitizers> -o hello hello.cpp<br>
> >><br>
> >> This is the output from setting verbosity=1 - how can I debug this issue?<br>
> >><br>
> >> ==3401806==AddressSanitizer: libc interceptors initialized<br>
> >> || `[0x10007fff8000, 0x7fffffffffff]` || HighMem ||<br>
> >> || `[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||<br>
> >> || `[0x00008fff7000, 0x02008fff6fff]` || ShadowGap ||<br>
> >> || `[0x00007fff8000, 0x00008fff6fff]` || LowShadow ||<br>
> >> || `[0x000000000000, 0x00007fff7fff]` || LowMem ||<br>
> >> MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff<br>
> >> redzone=16<br>
> >> max_redzone=2048<br>
> >> quarantine_size_mb=256M<br>
> >> thread_local_quarantine_size_kb=1024K<br>
> >> malloc_context_size=30<br>
> >> SHADOW_SCALE: 3<br>
> >> SHADOW_GRANULARITY: 8<br>
> >> SHADOW_OFFSET: 0x7fff8000<br>
> >> ==3401806==Installed the sigaction for signal 11<br>
> >> ==3401806==Installed the sigaction for signal 7<br>
> >> ==3401806==Installed the sigaction for signal 8<br>
> >> ==3401806==T0: stack [0x7fff3bf5c000,0x7fff3c75c000) size 0x800000;<br>
> >> local=0x7fff3c759244<br>
> >> ==3401806==AddressSanitizer Init done<br>
> >><br>
> >> ➜ readelf -d hello<br>
> >><br>
> >> Dynamic section at offset 0xe18 contains 25 entries:<br>
> >> Tag Type Name/Value<br>
> >> 0x0000000000000001 (NEEDED) Shared library: [<a href="http://libclang_rt.asan-x86_64.so" rel="noreferrer" target="_blank">libclang_rt.asan-x86_64.so</a>]<br>
> >> 0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]<br>
> >> 0x0000000000000001 (NEEDED) Shared library: [libm.so.6]<br>
> >> 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]<br>
> >> 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]<br>
> >> 0x000000000000000c (INIT) 0x400570<br>
> >> 0x000000000000000d (FINI) 0x4007b8<br>
> >> 0x0000000000000004 (HASH) 0x400278<br>
> >> 0x0000000000000005 (STRTAB) 0x400318<br>
> >> 0x0000000000000006 (SYMTAB) 0x4002a0<br>
> >> 0x000000000000000a (STRSZ) 462 (bytes)<br>
> >> 0x000000000000000b (SYMENT) 24 (bytes)<br>
> >> 0x0000000000000015 (DEBUG) 0x0<br>
> >> 0x0000000000000003 (PLTGOT) 0x601000<br>
> >> 0x0000000000000002 (PLTRELSZ) 72 (bytes)<br>
> >> 0x0000000000000014 (PLTREL) RELA<br>
> >> 0x0000000000000017 (JMPREL) 0x400528<br>
> >> 0x0000000000000007 (RELA) 0x400510<br>
> >> 0x0000000000000008 (RELASZ) 24 (bytes)<br>
> >> 0x0000000000000009 (RELAENT) 24 (bytes)<br>
> >> 0x000000006ffffffe (VERNEED) 0x4004f0<br>
> >> 0x000000006fffffff (VERNEEDNUM) 1<br>
> >> 0x000000006ffffff0 (VERSYM) 0x4004e6<br>
> >> 0x0000000000000000 (NULL) 0x0<br>
> >> _______________________________________________<br>
> >> LLVM Developers mailing list<br>
> >> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> >> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>