Skip to content

__bf16 <-> _Float16 failure #90738

@hjl-tools

Description

@hjl-tools
[hjl@gnu-cfl-3 pr114907]$ cat foo.c
__bf16
foo (_Float16 x)
{
  return x;
}
[hjl@gnu-cfl-3 pr114907]$ make CC=clang foo.s
clang -O2 -S foo.c
fatal error: error in backend: Do not know how to soft promote this operator's result!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: clang -O2 -S foo.c
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'foo.c'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@foo'
 #0 0x00007fd85be0440a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.18.1+0x60440a)
 #1 0x00007fd85be01bf4 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.18.1+0x601bf4)
 #2 0x00007fd85bd35e92 (/lib64/libLLVM.so.18.1+0x535e92)
 #3 0x00007fd85bd35e4f (/lib64/libLLVM.so.18.1+0x535e4f)
 #4 0x00007fd85bdfe0cf (/lib64/libLLVM.so.18.1+0x5fe0cf)
 #5 0x00000000004147c7 (/usr/bin/clang-18+0x4147c7)
 #6 0x00007fd85bd46a77 llvm::report_fatal_error(llvm::Twine const&, bool) (/lib64/libLLVM.so.18.1+0x546a77)
 #7 0x00007fd85bd4693a (/lib64/libLLVM.so.18.1+0x54693a)
 #8 0x00007fd85c6402e8 (/lib64/libLLVM.so.18.1+0xe402e8)
 #9 0x00007fd85c67c73d llvm::SelectionDAG::LegalizeTypes() (/lib64/libLLVM.so.18.1+0xe7c73d)
#10 0x00007fd85c79a6d1 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/lib64/libLLVM.so.18.1+0xf9a6d1)
#11 0x00007fd85c7997b4 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/lib64/libLLVM.so.18.1+0xf997b4)
#12 0x00007fd85c7970ba llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/lib64/libLLVM.so.18.1+0xf970ba)
#13 0x00007fd85f1b1cb0 (/lib64/libLLVM.so.18.1+0x39b1cb0)
#14 0x00007fd85c2683e9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/lib64/libLLVM.so.18.1+0xa683e9)
#15 0x00007fd85bf894e5 llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib64/libLLVM.so.18.1+0x7894e5)
#16 0x00007fd85bf90e43 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib64/libLLVM.so.18.1+0x790e43)
#17 0x00007fd85bf89c09 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM.so.18.1+0x789c09)
#18 0x00007fd86425c08b clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/lib64/libclang-cpp.so.18.1+0x185c08b)
#19 0x00007fd864659be0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.18.1+0x1c59be0)
#20 0x00007fd862f74386 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.18.1+0x574386)
#21 0x00007fd86521c896 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18.1+0x281c896)
#22 0x00007fd8651945a0 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.18.1+0x27945a0)
#23 0x00007fd865299df5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18.1+0x2899df5)
#24 0x00000000004144c6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-18+0x4144c6)
#25 0x0000000000411164 (/usr/bin/clang-18+0x411164)
#26 0x00007fd864dc523d (/lib64/libclang-cpp.so.18.1+0x23c523d)
#27 0x00007fd85bd35e24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM.so.18.1+0x535e24)
#28 0x00007fd864dc4ca7 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.18.1+0x23c4ca7)
#29 0x00007fd864d8aa07 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.18.1+0x238aa07)
#30 0x00007fd864d8ac67 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.18.1+0x238ac67)
#31 0x00007fd864da90ce clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.18.1+0x23a90ce)
#32 0x00000000004109bf clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-18+0x4109bf)
#33 0x000000000041dcba main (/usr/bin/clang-18+0x41dcba)
#34 0x00007fd85b23d088 __libc_start_call_main (/lib64/libc.so.6+0x2a088)
#35 0x00007fd85b23d14b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14b)
#36 0x000000000040d8a5 _start (/usr/bin/clang-18+0x40d8a5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.1 (Fedora 18.1.1-1.fc40)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/clang.cfg
clang: note: diagnostic msg: 
********************

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

********************
make: *** [Makefile:33: foo.s] Error 1
[hjl@gnu-cfl-3 pr114907]$ cat bar.c
_Float16
foo (__bf16 x)
{
  return x;
}
[hjl@gnu-cfl-3 pr114907]$ make CC=clang bar.s
clang -O2 -S bar.c
fatal error: error in backend: Do not know how to soft promote this operator's operand!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: clang -O2 -S bar.c
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'bar.c'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@foo'
 #0 0x00007fe53ce0440a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.18.1+0x60440a)
 #1 0x00007fe53ce01bf4 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.18.1+0x601bf4)
 #2 0x00007fe53cd35e92 (/lib64/libLLVM.so.18.1+0x535e92)
 #3 0x00007fe53cd35e4f (/lib64/libLLVM.so.18.1+0x535e4f)
 #4 0x00007fe53cdfe0cf (/lib64/libLLVM.so.18.1+0x5fe0cf)
 #5 0x00000000004147c7 (/usr/bin/clang-18+0x4147c7)
 #6 0x00007fe53cd46a77 llvm::report_fatal_error(llvm::Twine const&, bool) (/lib64/libLLVM.so.18.1+0x546a77)
 #7 0x00007fe53cd4693a (/lib64/libLLVM.so.18.1+0x54693a)
 #8 0x00007fe53d6428a0 (/lib64/libLLVM.so.18.1+0xe428a0)
 #9 0x00007fe53d67c6c0 llvm::SelectionDAG::LegalizeTypes() (/lib64/libLLVM.so.18.1+0xe7c6c0)
#10 0x00007fe53d79a6d1 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/lib64/libLLVM.so.18.1+0xf9a6d1)
#11 0x00007fe53d7997b4 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/lib64/libLLVM.so.18.1+0xf997b4)
#12 0x00007fe53d7970ba llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/lib64/libLLVM.so.18.1+0xf970ba)
#13 0x00007fe5401b1cb0 (/lib64/libLLVM.so.18.1+0x39b1cb0)
#14 0x00007fe53d2683e9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/lib64/libLLVM.so.18.1+0xa683e9)
#15 0x00007fe53cf894e5 llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib64/libLLVM.so.18.1+0x7894e5)
#16 0x00007fe53cf90e43 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib64/libLLVM.so.18.1+0x790e43)
#17 0x00007fe53cf89c09 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM.so.18.1+0x789c09)
#18 0x00007fe54525c08b clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/lib64/libclang-cpp.so.18.1+0x185c08b)
#19 0x00007fe545659be0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.18.1+0x1c59be0)
#20 0x00007fe543f74386 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.18.1+0x574386)
#21 0x00007fe54621c896 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18.1+0x281c896)
#22 0x00007fe5461945a0 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.18.1+0x27945a0)
#23 0x00007fe546299df5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18.1+0x2899df5)
#24 0x00000000004144c6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-18+0x4144c6)
#25 0x0000000000411164 (/usr/bin/clang-18+0x411164)
#26 0x00007fe545dc523d (/lib64/libclang-cpp.so.18.1+0x23c523d)
#27 0x00007fe53cd35e24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM.so.18.1+0x535e24)
#28 0x00007fe545dc4ca7 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.18.1+0x23c4ca7)
#29 0x00007fe545d8aa07 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.18.1+0x238aa07)
#30 0x00007fe545d8ac67 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.18.1+0x238ac67)
#31 0x00007fe545da90ce clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.18.1+0x23a90ce)
#32 0x00000000004109bf clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-18+0x4109bf)
#33 0x000000000041dcba main (/usr/bin/clang-18+0x41dcba)
#34 0x00007fe53c23d088 __libc_start_call_main (/lib64/libc.so.6+0x2a088)
#35 0x00007fe53c23d14b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14b)
#36 0x000000000040d8a5 _start (/usr/bin/clang-18+0x40d8a5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.1 (Fedora 18.1.1-1.fc40)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/clang.cfg
clang: note: diagnostic msg: 
********************

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

********************
make: *** [Makefile:33: bar.s] Error 1
[hjl@gnu-cfl-3 pr114907]$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:codegenIR generation bugs: mangling, exceptions, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions