llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.02k stars 11.96k forks source link

[Clang] [HLSL] wrong command line causes unreachable #57774

Open thewilsonator opened 2 years ago

thewilsonator commented 2 years ago
% ../llvm/llvm-build/bin/clang -S -emit-llvm ../llvm/llvm-project/clang/test/CodeGenHLSL/shader_type_attr.hlsl -o shader_type_attr.ll -target dxil-pc-shadermodel6.3-library --driver-mode=dxc -Tlib_6_x -fcgl -Fo
clang-15: error: argument to '-Fo' is missing (expected 1 value)
clang-15: error: unknown argument: '-S'
clang-15: error: unknown argument: '-emit-llvm'
clang-15: error: unknown argument: '-o'
Linking is not supported by this toolchain
UNREACHABLE executed at llvm/llvm-project/clang/lib/Driver/ToolChain.cpp:311!
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: ../llvm/llvm-build/bin/clang -S -emit-llvm ../llvm/llvm-project/clang/test/CodeGenHLSL/shader_type_attr.hlsl -o shader_type_attr.ll -target dxil-pc-shadermodel6.3-library --driver-mode=dxc -Tlib_6_x -fcgl -Fo
1.  Compilation construction
2.  Building compilation jobs
3.  Building compilation jobs
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  clang                    0x0000000105842268 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 68
1  clang                    0x000000010584275c PrintStackTraceSignalHandler(void*) + 28
2  clang                    0x000000010584085c llvm::sys::RunSignalHandlers() + 136
3  clang                    0x0000000105844790 SignalHandler(int) + 220
4  libsystem_platform.dylib 0x0000000184ebec44 _sigtramp + 56
5  libsystem_pthread.dylib  0x0000000184e7343c pthread_kill + 292
6  libsystem_c.dylib        0x0000000184dbb454 abort + 124
7  clang                    0x0000000105691dd8 llvm::install_out_of_memory_new_handler() + 0
8  clang                    0x0000000106a68208 clang::driver::ToolChain::buildStaticLibTool() const + 0
9  clang                    0x0000000106a68334 clang::driver::ToolChain::getLink() const + 60
10 clang                    0x0000000106a686b4 clang::driver::ToolChain::getTool(clang::driver::Action::ActionClass) const + 112
11 clang                    0x0000000106a69824 clang::driver::ToolChain::SelectTool(clang::driver::JobAction const&) const + 192
12 clang                    0x00000001069ff224 (anonymous namespace)::ToolSelector::getTool(llvm::SmallVector<clang::driver::Action*, 3u>&, llvm::SmallVector<clang::driver::Action*, 3u>&) + 464
13 clang                    0x00000001069fdbe8 clang::driver::Driver::BuildJobsForActionNoCache(clang::driver::Compilation&, clang::driver::Action const*, clang::driver::ToolChain const*, llvm::StringRef, bool, bool, char const*, std::__1::map<std::__1::pair<clang::driver::Action const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::SmallVector<clang::driver::InputInfo, 4u>, std::__1::less<std::__1::pair<clang::driver::Action const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, std::__1::allocator<std::__1::pair<std::__1::pair<clang::driver::Action const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> const, llvm::SmallVector<clang::driver::InputInfo, 4u>>>>&, clang::driver::Action::OffloadKind) const + 1564
14 clang                    0x00000001069fd120 clang::driver::Driver::BuildJobsForAction(clang::driver::Compilation&, clang::driver::Action const*, clang::driver::ToolChain const*, llvm::StringRef, bool, bool, char const*, std::__1::map<std::__1::pair<clang::driver::Action const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::SmallVector<clang::driver::InputInfo, 4u>, std::__1::less<std::__1::pair<clang::driver::Action const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, std::__1::allocator<std::__1::pair<std::__1::pair<clang::driver::Action const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> const, llvm::SmallVector<clang::driver::InputInfo, 4u>>>>&, clang::driver::Action::OffloadKind) const + 372
15 clang                    0x00000001069f244c clang::driver::Driver::BuildJobs(clang::driver::Compilation&) const + 1160
16 clang                    0x00000001069ee75c clang::driver::Driver::BuildCompilation(llvm::ArrayRef<char const*>) + 5048
17 clang                    0x00000001024dcd70 clang_main(int, char**) + 2716
18 clang                    0x00000001025142b4 main + 36
19 libdyld.dylib            0x0000000184e91430 start + 4
zsh: abort      ../llvm/llvm-build/bin/clang -S -emit-llvm  -o shader_type_attr.ll -target

I gather that -S -emit-llvm ../llvm/llvm-project/clang/test/CodeGenHLSL/shader_type_attr.hlsl -o shader_type_attr.ll -target dxil-pc-shadermodel6.3-library --driver-mode=dxc -Tlib_6_x -fcgl -Fo is an invalid combination of flags, but it shouldn't hit an unreachable.

llvmbot commented 2 years ago

@llvm/issue-subscribers-clang-driver