<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 6, 2016 at 1:33 AM, Hahnfeld, Jonas <span dir="ltr"><<a href="mailto:Hahnfeld@itc.rwth-aachen.de" target="_blank">Hahnfeld@itc.rwth-aachen.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><u></u> <u></u></p><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Alexey Samsonov [mailto:<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>] <br><b>Sent:</b> Friday, February 05, 2016 11:05 PM<br><b>To:</b> Kostya Serebryany<br><b>Cc:</b> Hahnfeld, Jonas; <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><b>Subject:</b> Re: [cfe-dev] Sanitizer test failures when switching to libc++ by default<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><div><span class=""><p class="MsoNormal">On Fri, Feb 5, 2016 at 11:11 AM, Kostya Serebryany via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p></span><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><u></u> <u></u></p><div><span class=""><p class="MsoNormal">On Fri, Feb 5, 2016 at 6:21 AM, Hahnfeld, Jonas via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p><p class="MsoNormal">Hi all,<br><br>I'm currently looking into (optionally) switching the default C++ stdlib to<br>libc++ (see <a href="http://reviews.llvm.org/D15920" target="_blank">http://reviews.llvm.org/D15920</a> which hasn't received a review so<br>far)<br>I've resolved all regression test failures in clang which are now passing<br>cleanly.<br><br>I'm now investigating the failing sanitizer tests in compiler-rt, here's<br>what I got so far:<br> - two tests use -static-libstdc++ which obviously needs a -stdlib=libstdc++<br>(asan/TestCases/throw_invoke_test.cc and tsan/static_init6.cc)<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Makes sense. <u></u><u></u></p></div></span><div><span class=""><p class="MsoNormal">I wonder if we can also use -static-libc++ for these tests<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p></span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">At least in my build there is not static version of libc++… I think this isn’t built by default but I haven’t yet searched for an opt-in.<u></u><u></u></span></p></div><span class=""><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><p class="MsoNormal"> - tsan builds an instrumented version of libc++ and adds their headers.<br>This leads to errors with default C headers which are #include_next'd in<br>libc++. These #include_next then find the headers of the "normal" libc++<br>which in turn instantly return because of the header guards. Therefore basic<br>functions like printf aren't defined.<br>Solution: Pass -nostdinc++ to disable the headers of the "normal" libc++<u></u><u></u></p></blockquote><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">emm, probably. <u></u><u></u></p></div></span></div></div></div><span class=""><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Just to clarify: do you want to pass it to TSan lit tests? How would you ensure that<u></u><u></u></p></div><div><p class="MsoNormal">we'll still pick up C++ standard library headers when tests are run with Clang configured<u></u><u></u></p></div></span><div><p class="MsoNormal">to use libstdc++?<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I’m planning on passing it in test/tsan/lit.cfg around line 57. Those flags are only applied if an instrumented version of libcxx is available and there is an explicit definition of the header include path, so this should work.</span></p></div></div></div></div></div></div></div></blockquote><div><br></div><div>I see. Yes, probably -nostdinc++ would work in this case.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><div><div><div><span class=""><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><p class="MsoNormal"> - lsan completely fails with libc++, I had to generally pass<br>-stdlib=libstdc++ - is this known and possibly still work in progress?<u></u><u></u></p></blockquote><div><p class="MsoNormal"><u></u> <u></u></p></div></span><div><span class=""><p class="MsoNormal">This is not known to me. What are the symptoms? <u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p></span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">“LeakSanitizer has encountered a fatal error” on all C++ tests. This is fixed when building the tests with “-stdlib=libstdc++”, everything else still built with libc++…<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I also can’t debug with gdb because the errors seems to not occur inside a debugger :-( is there any special trick with the sanitizers inside a debugger that I have not found yet?</span></p></div></div></div></div></blockquote></div></div></div></div></div></div></blockquote><div><br></div><div>LSan uses ptrace to stop the program and list all its threads, the same as GDB. So, LSan is sadly special in this case. You can try to gain more insight into what's happening by running the binary</div><div>with smth. like LSAN_OPTIONS=verbosity=1:log_pointers=1:log_threads=1 (apart from LSAN_OPTIONS specified in each lit test case).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"><div><div><div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><div><div><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> <u></u><u></u></span></p></div><span class=""><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><p class="MsoNormal" style="margin-bottom:12.0pt"><br>Greetings,<br>Jonas<br><br>--<br>Jonas Hahnfeld, MATSE-Auszubildender<br><br>IT Center<br>Group: High Performance Computing<br>Division: Computational Science and Engineering<br>RWTH Aachen University<br>Seffenter Weg 23<br>D 52074 Aachen (Germany)<br><a href="mailto:Hahnfeld@itc.rwth-aachen.de" target="_blank">Hahnfeld@itc.rwth-aachen.de</a><br><a href="http://www.itc.rwth-aachen.de" target="_blank">www.itc.rwth-aachen.de</a><br><br><br>_______________________________________________<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" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><u></u><u></u></p></blockquote></span></div><p class="MsoNormal"><u></u> <u></u></p></div></div><span class=""><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<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" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><u></u><u></u></p></span></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><p class="MsoNormal">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a><u></u><u></u></p></div></div></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>