Skip to content

SelectionDAG.cpp:4662: llvm::SDValue llvm::SelectionDAG::getNode(unsigned int, const llvm::SDLoc &, llvm::EVT, llvm::SDValue, const llvm::SDNodeFlags): Assertion `VT.isInteger() && Operand.getValueType().isInteger() && "Invalid TRUNCATE!"' failed. #44335

@berolinux

Description

@berolinux
Bugzilla Link 44990
Resolution FIXED
Resolved on Feb 25, 2020 13:46
Version 10.0
OS Linux
Blocks #43900
CC @Arnaud-de-Grandmaison-ARM,@zmodem,@RKSimon,@smithp35

Extended Description

Spotted while crosscompiling musl from x86_64 to aarch64 - looks like something that will happen on a native aarch64 compiler as well.
-frounding-math is needed.

Test case can be reduced to a one-liner.

$ echo 'float a() { return 0; }' >test.c
$ clang -target aarch64-openmandriva-linux-gnu -frounding-math -o test.o -c test.c
clang: /builddir/build/BUILD/llvm-project-release-10.x/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4662: llvm::SDValue llvm::SelectionDAG::getNode(unsigned int, const llvm::SDLoc &, llvm::EVT, llvm::SDValue, const llvm::SDNodeFlags): Assertion `VT.isInteger() && Operand.getValueType().isInteger() && "Invalid TRUNCATE!"' failed.
Stack dump:
0. Program arguments: clang -target aarch64-openmandriva-linux-gnu -frounding-math -o test.o -c test.c

  1.  <eof> parser at end of file
    
  2.  Code generation
    
  3.  Running pass 'Function Pass Manager' on module 'test.c'.
    
  4.  Running pass 'AArch64 Instruction Selection' on function '@a'
    

#​0 0x00007f5f2eb6df02 (/usr/lib64/libLLVMSupport.so.10.0+0x21bf02)
#​1 0x00007f5f2eb6b4ae llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVMSupport.so.10.0+0x2194ae)
#​2 0x00007f5f2eb6cf60 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib64/libLLVMSupport.so.10.0+0x21af60)
#​3 0x00007f5f2ea8ac13 (/usr/lib64/libLLVMSupport.so.10.0+0x138c13)
#​4 0x00007f5f2ea8ad83 (/usr/lib64/libLLVMSupport.so.10.0+0x138d83)
#​5 0x00007f5f2e5c8980 __restore_rt (/lib64/libc.so.6+0x44980)
#​6 0x00007f5f2e5c88f7 raise (/lib64/libc.so.6+0x448f7)
#​7 0x00007f5f2e5a953d abort (/lib64/libc.so.6+0x2553d)
#​8 0x00007f5f2e5a9411 _nl_load_domain.cold (/lib64/libc.so.6+0x25411)
#​9 0x00007f5f2e5b9912 (/lib64/libc.so.6+0x35912)
#​10 0x00007f5f2e24bded llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) (/usr/lib64/libLLVMSelectionDAG.so.10.0+0x300ded)
#​11 0x00007f5f2e10d510 (/usr/lib64/libLLVMSelectionDAG.so.10.0+0x1c2510)
#​12 0x00007f5f2e10bf3f llvm::SelectionDAG::Legalize() (/usr/lib64/libLLVMSelectionDAG.so.10.0+0x1c0f3f)
#​13 0x00007f5f2e2a5dea llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib64/libLLVMSelectionDAG.so.10.0+0x35adea)
#​14 0x00007f5f2e2a3afe llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib64/libLLVMSelectionDAG.so.10.0+0x358afe)
#​15 0x00007f5f2e2a039b llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/lib64/libLLVMSelectionDAG.so.10.0+0x35539b)
#​16 0x00007f5f313bfb0e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib64/libLLVMCodeGen.so.10.0+0x43eb0e)
#​17 0x00007f5f2f01fdaf llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib64/libLLVMCore.so.10.0+0x38fdaf)
#​18 0x00007f5f2f020183 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib64/libLLVMCore.so.10.0+0x390183)
#​19 0x00007f5f2f020809 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib64/libLLVMCore.so.10.0+0x390809)
#​20 0x00007f5f318cdb6b clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/usr/lib64/libclangCodeGen.so.10.0+0x249b6b)
#​21 0x00007f5f31c1d0f0 (/usr/lib64/libclangCodeGen.so.10.0+0x5990f0)
#​22 0x00007f5f2c962864 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib64/libclangParse.so.10.0+0x6c864)
#​23 0x00007f5f31c18285 clang::CodeGenAction::ExecuteAction() (/usr/lib64/libclangCodeGen.so.10.0+0x594285)
#​24 0x00007f5f303b7cdd clang::FrontendAction::Execute() (/usr/lib64/libclangFrontend.so.10.0+0x174cdd)
#​25 0x00007f5f3033d19a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib64/libclangFrontend.so.10.0+0xfa19a)
#​26 0x00007f5f3264a9b4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclangFrontendTool.so.10.0+0x59b4)
#​27 0x00000000002180d0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-10+0x2180d0)
#​28 0x0000000000215fe1 (/usr/bin/clang-10+0x215fe1)
#​29 0x00007f5f300abd62 (/usr/lib64/libclangDriver.so.10.0+0xf7d62)
#​30 0x00007f5f2ea8ab21 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib64/libLLVMSupport.so.10.0+0x138b21)
#​31 0x00007f5f300ab167 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optionalllvm::StringRef >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool) const (/usr/lib64/libclangDriver.so.10.0+0xf7167)
#​32 0x00007f5f30072a5a clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/usr/lib64/libclangDriver.so.10.0+0xbea5a)
#​33 0x00007f5f30072f7a clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/usr/lib64/libclangDriver.so.10.0+0xbef7a)
#​34 0x00007f5f3008ee37 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/usr/lib64/libclangDriver.so.10.0+0xdae37)
#​35 0x0000000000214fde main (/usr/bin/clang-10+0x214fde)
#​36 0x00007f5f2e5aadbb __libc_start_main (/lib64/libc.so.6+0x26dbb)
#​37 0x0000000000211a2a _start (/usr/bin/clang-10+0x211a2a)
clang-10: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 10.0.0
Target: aarch64-openmandriva-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang-10: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/test-cd715c.c
clang-10: note: diagnostic msg: /tmp/test-cd715c.sh
clang-10: note: diagnostic msg:


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions