<div dir="ltr">I have landed <a href="http://reviews.llvm.org/D19427" target="_blank" class="cremed">http://reviews.llvm.org/D19427</a> to fix the test on FreeBSD.<br><br><div class="gmail_quote"><div dir="ltr">On Mon, May 2, 2016 at 12:29 PM Dimitry Andric <<a href="mailto:dimitry@andric.com" target="_blank" class="cremed">dimitry@andric.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 02 May 2016, at 20:43, Ed Maste <<a href="mailto:emaste@freebsd.org" target="_blank" class="cremed">emaste@freebsd.org</a>> wrote:<br>
><br>
> On 2 May 2016 at 13:15, Evgenii Stepanov <<a href="mailto:eugeni.stepanov@gmail.com" target="_blank" class="cremed">eugeni.stepanov@gmail.com</a>> wrote:<br>
>> file+line should be enough. This is not a debug info / demangler test,<br>
>> let's not make it more fragile then necessary.<br>
><br>
> That sounds fine to me. We definitely want to fix the underlying bugs<br>
> in FreeBSD (via libcxxrt / elftoolchain) but this test indeed isn't<br>
> the place to test those.<br>
><br>
> One caveat, Dimitry reported that there's another failure due to<br>
> __cxa_demangle turning "foo" into "float". In this case FreeBSD's<br>
> __cxa_demangle is not sufficiently validating its input, but<br>
> __cxa_demangle should not have been called at all.  As __cxa_demangle<br>
> also handles type names it will correctly return "float" for input<br>
> "f", which is not what's desired here. I've submitted<br>
> <a href="http://reviews.llvm.org/D19818" rel="noreferrer" target="_blank" class="cremed">http://reviews.llvm.org/D19818</a> for that issue.<br>
<br>
Yes, I had tried a similar fix, namely this:<br>
<br>
Index: projects/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc<br>
===================================================================<br>
--- projects/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc     (revision 268169)<br>
+++ projects/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc     (working copy)<br>
@@ -50,6 +50,10 @@<br>
<br>
 // Attempts to demangle the name via __cxa_demangle from __cxxabiv1.<br>
 const char *DemangleCXXABI(const char *name) {<br>
+  // C++ mangled names should start with "_Z".<br>
+  if (name[0] != '_' || name[1] != 'Z')<br>
+    return name;<br>
+<br>
   // FIXME: __cxa_demangle aggressively insists on allocating memory.<br>
   // There's not much we can do about that, short of providing our<br>
   // own demangler (libc++abi's implementation could be adapted so that<br>
<br>
but this leads to at least new 4 UBSan failures (which were definitely *not* there before the above fix), for example:<br>
<br>
Command Output (stderr):<br>
--<br>
/share/dim/src/llvm/trunk/projects/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp:16:17: error: expected string not found in input<br>
 // CHECK-NEXT: [[PTR]]: note: object is of type 'Foo'<br>
                ^<br>
<stdin>:2:1: note: scanning from here<br>
0xbfbfeb30: note: object is of type '3Foo'<br>
^<br>
<stdin>:2:1: note: with variable "PTR" equal to "0xbfbfeb30"<br>
0xbfbfeb30: note: object is of type '3Foo'<br>
^<br>
<stdin>:2:11: note: possible intended match here<br>
0xbfbfeb30: note: object is of type '3Foo'<br>
          ^<br>
<br>
See test-failures.txt for the full details.  It seems that these tests depend on the demangler 'unconditionally' demangling non-C++ mangled names.<br>
<br>
-Dimitry<br>
</blockquote></div></div>