[llvm-bugs] [Bug 35201] New: CFI: Assert triggered by LowerTypeTests

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 3 15:41:00 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=35201

            Bug ID: 35201
           Summary: CFI: Assert triggered by LowerTypeTests
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: dmitry.mikulin at sony.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19369
  --> https://bugs.llvm.org/attachment.cgi?id=19369&action=edit
repro test case

Compiling and linking the attached test case with CFI enabled hits an assert
replacing a function pointer use in blockaddress with a jump table pointer
generated by CFI instrumentation.


# clang -O0  -flto -fvisibility=hidden -fsanitize=cfi -c -target
x86_64-unknown-linux test.c
# ld.lld test.o
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file
/Users/dmikulin/Dev/llvm-project/llvm/include/llvm/Support/Casting.h, line 255.
0  ld.lld                   0x000000010bc3143c
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1  ld.lld                   0x000000010bc319b9
PrintStackTraceSignalHandler(void*) + 25
2  ld.lld                   0x000000010bc2d3e9 llvm::sys::RunSignalHandlers() +
425
3  ld.lld                   0x000000010bc31ff2 SignalHandler(int) + 354
4  libsystem_platform.dylib 0x00007fff90bf052a _sigtramp + 26
5  libsystem_platform.dylib 0x4e8c155bd9ddce45 _sigtramp + 1226754357
6  libsystem_c.dylib        0x00007fff8b5626df abort + 129
7  libsystem_c.dylib        0x00007fff8b529dd8 basename + 0
8  ld.lld                   0x000000010fbbcb67 llvm::cast_retty<llvm::Function,
llvm::Value*>::ret_type llvm::cast<llvm::Function, llvm::Value>(llvm::Value*) +
103
9  ld.lld                   0x000000010fbbc6bb
llvm::BlockAddress::handleOperandChangeImpl(llvm::Value*, llvm::Value*) + 123
10 ld.lld                   0x000000010fbc38de
llvm::Constant::handleOperandChange(llvm::Value*, llvm::Value*) + 270
11 ld.lld                   0x000000010fddc4bf
llvm::Value::doRAUW(llvm::Value*, bool) + 495
12 ld.lld                   0x000000010fddcb0f
llvm::Value::replaceAllUsesWith(llvm::Value*) + 31
13 ld.lld                   0x000000010eb2e64f (anonymous
namespace)::LowerTypeTestsModule::buildBitSetsFromFunctionsNative(llvm::ArrayRef<llvm::Metadata*>,
llvm::ArrayRef<(anonymous namespace)::GlobalTypeMember*>) + 2367
14 ld.lld                   0x000000010eb223cf (anonymous
namespace)::LowerTypeTestsModule::buildBitSetsFromFunctions(llvm::ArrayRef<llvm::Metadata*>,
llvm::ArrayRef<(anonymous namespace)::GlobalTypeMember*>) + 159
15 ld.lld                   0x000000010eb0c6d9 (anonymous
namespace)::LowerTypeTestsModule::buildBitSetsFromDisjointSet(llvm::ArrayRef<llvm::Metadata*>,
llvm::ArrayRef<(anonymous namespace)::GlobalTypeMember*>) + 5753
16 ld.lld                   0x000000010eaf2666 (anonymous
namespace)::LowerTypeTestsModule::lower() + 11334
17 ld.lld                   0x000000010eaf3a22 (anonymous
namespace)::LowerTypeTests::runOnModule(llvm::Module&) + 146
18 ld.lld                   0x000000010fcf517f (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 1967
19 ld.lld                   0x000000010fcf4756
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 342
20 ld.lld                   0x000000010fcf5dd1
llvm::legacy::PassManager::run(llvm::Module&) + 33
21 ld.lld                   0x000000010e27b378 (anonymous
namespace)::runOldPMPasses(llvm::lto::Config&, llvm::Module&,
llvm::TargetMachine*, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex
const*) + 424
22 ld.lld                   0x000000010e2756b3 (anonymous
namespace)::opt(llvm::lto::Config&, llvm::TargetMachine*, unsigned int,
llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex
const*) + 499
23 ld.lld                   0x000000010e2729a1
llvm::lto::backend(llvm::lto::Config&,
std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream,
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>,
unsigned int, std::__1::unique_ptr<llvm::Module,
std::__1::default_delete<llvm::Module> >, llvm::ModuleSummaryIndex&) + 1649
24 ld.lld                   0x000000010e244417
llvm::lto::LTO::runRegularLTO(std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream,
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>) +
5127
25 ld.lld                   0x000000010e242de1
llvm::lto::LTO::run(std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream,
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>,
std::__1::function<std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream,
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>
(unsigned int, llvm::StringRef)>) + 1473
26 ld.lld                   0x000000010be974a5
lld::elf::BitcodeCompiler::compile() + 789
27 ld.lld                   0x000000010bfd4f3d void
lld::elf::SymbolTable::addCombinedLTOObject<llvm::object::ELFType<(llvm::support::endianness)1,
true> >() + 973
28 ld.lld                   0x000000010bd96c8a void
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(llvm::opt::InputArgList&) + 4986
29 ld.lld                   0x000000010bd85485
lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>, bool) + 3877
30 ld.lld                   0x000000010bd84124
lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&) + 2644
31 ld.lld                   0x000000010ba8cbcc main + 444
32 libdyld.dylib            0x00007fff87eb15ad start + 1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171103/5abaf546/attachment.html>


More information about the llvm-bugs mailing list