[PATCH] D22939: Only use __cxa_demangle on C++ mangled names
Dimitry Andric via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 29 01:46:29 PDT 2016
dim added a comment.
So when we fix `DemangleCXXABI()` to only really demangle identifiers starting with "_Z", some UBSan tests start failing, for example:
FAIL: UBSan-ASan-i386 :: TestCases/TypeCheck/vptr-virtual-base.cpp (27899 of 27987)
******************** TEST 'UBSan-ASan-i386 :: TestCases/TypeCheck/vptr-virtual-base.cpp' FAILED ********************
Script:
--
/home/dim/obj/llvm-asan-276903/./bin/clang --driver-mode=g++ -fsanitize=address -m32 -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g /share/dim/src/llvm/asantest/projects/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp -O3 -o /usr/home/dim/obj/llvm-asan-276903/projects/compiler-rt/test/ubsan/AddressSanitizer-i386/TestCases/TypeCheck/Output/vptr-virtual-base.cpp.tmp
not /usr/home/dim/obj/llvm-asan-276903/projects/compiler-rt/test/ubsan/AddressSanitizer-i386/TestCases/TypeCheck/Output/vptr-virtual-base.cpp.tmp 2>&1 | FileCheck /share/dim/src/llvm/asantest/projects/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
--
Exit Code: 1
Command Output (stderr):
--
/share/dim/src/llvm/asantest/projects/compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp:16:17: error: expected string not found in input
// CHECK-NEXT: [[PTR]]: note: object is of type 'Foo'
^
<stdin>:2:1: note: scanning from here
0xbfbfebb0: note: object is of type '3Foo'
^
<stdin>:2:1: note: with variable "PTR" equal to "0xbfbfebb0"
0xbfbfebb0: note: object is of type '3Foo'
^
<stdin>:2:11: note: possible intended match here
0xbfbfebb0: note: object is of type '3Foo'
^
The "object is of type '3Foo'" message is emitted from UBSan's `HandleDynamicTypeCacheMiss()`, where it calls `TypeName(DTI.getMostDerivedTypeName())` to get the string representation of the type. This ultimately calls into `getDynamicTypeInfoFromVtable()`, and apparently there is no addition of "_Z" to the type name there.
If we would add _Z to a the output of getMostDerivedTypeName(), I think a lot of other tests might also fall over, so I am unsure what the best approach is for fixing this.
https://reviews.llvm.org/D22939
More information about the llvm-commits
mailing list