Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-20 crashed with vector_size attribute in struct. huge 'byval' arguments are unsupported. #115655

Open
iamanonymouscs opened this issue Nov 10, 2024 · 2 comments
Labels
backend:X86 crash Prefer [crash-on-valid] or [crash-on-invalid] new issue

Comments

@iamanonymouscs
Copy link

clang-20 crashed with vector_size attribute in struct.
While GCC accepts this code.

Compiler explorer: https://godbolt.org/z/54PGhTfK4

$cat mutant.c
typedef struct {
  __attribute__((vector_size(32))) char a[1073741824];
} b;
void c(b d) {}

$clang-20 mutant.c
huge 'byval' arguments are unsupported
ptr @c
fatal error: error in backend: Broken module found, compilation aborted!
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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.	<eof> parser at end of file
2.	Optimizer
3.	Running pass "verify" on module "<source>"
 #0 0x0000000003bfc118 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bfc118)
 #1 0x0000000003bf9e1c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bf9e1c)
 #2 0x0000000003b47986 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b47986)
 #3 0x0000000003bf113e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bf113e)
 #4 0x0000000000ce80a0 LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x0000000003b529f3 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b529f3)
 #6 0x0000000003b52b58 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b52b58)
 #7 0x00000000035e1190 llvm::VerifierPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35e1190)
 #8 0x0000000003e97cae llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e97cae)
 #9 0x00000000035afdd0 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35afdd0)
#10 0x0000000003ea8dab (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#11 0x0000000003eac5d5 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*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3eac5d5)
#12 0x0000000004577fce clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4577fce)
#13 0x000000000672463c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x672463c)
#14 0x00000000045783b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45783b8)
#15 0x0000000004833519 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4833519)
#16 0x00000000047b278e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47b278e)
#17 0x000000000491931e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x491931e)
#18 0x0000000000cea5af cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcea5af)
#19 0x0000000000ce226a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#20 0x00000000045bb5b9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#21 0x0000000003b478c4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b478c4)
#22 0x00000000045bbbaf clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#23 0x0000000004581e9d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4581e9d)
#24 0x0000000004582f8d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4582f8d)
#25 0x000000000458a345 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x458a345)
#26 0x0000000000ce7449 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce7449)
#27 0x0000000000bb3b54 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbb3b54)
#28 0x00007d0a1fc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#29 0x00007d0a1fc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#30 0x0000000000ce1d1e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce1d1e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70

It can be compiled without vector_size attribute.

@hstk30-hw
Copy link
Contributor

Godbolt Assert trunk fail, but trunk not fail, 19 also not fail.

@hstk30-hw hstk30-hw added backend:X86 crash Prefer [crash-on-valid] or [crash-on-invalid] labels Nov 11, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 11, 2024

@llvm/issue-subscribers-backend-x86

Author: Anonymous (iamanonymouscs)

clang-20 crashed with ```vector_size``` attribute in struct. While GCC accepts this code.

Compiler explorer: https://godbolt.org/z/54PGhTfK4

$cat mutant.c
typedef struct {
  __attribute__((vector_size(32))) char a[1073741824];
} b;
void c(b d) {}

$clang-20 mutant.c
huge 'byval' arguments are unsupported
ptr @<!-- -->c
fatal error: error in backend: Broken module found, compilation aborted!
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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics &lt;source&gt;
1.	&lt;eof&gt; parser at end of file
2.	Optimizer
3.	Running pass "verify" on module "&lt;source&gt;"
 #<!-- -->0 0x0000000003bfc118 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bfc118)
 #<!-- -->1 0x0000000003bf9e1c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bf9e1c)
 #<!-- -->2 0x0000000003b47986 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b47986)
 #<!-- -->3 0x0000000003bf113e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bf113e)
 #<!-- -->4 0x0000000000ce80a0 LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #<!-- -->5 0x0000000003b529f3 llvm::report_fatal_error(llvm::Twine const&amp;, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b529f3)
 #<!-- -->6 0x0000000003b52b58 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b52b58)
 #<!-- -->7 0x00000000035e1190 llvm::VerifierPass::run(llvm::Function&amp;, llvm::AnalysisManager&lt;llvm::Function&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35e1190)
 #<!-- -->8 0x0000000003e97cae llvm::detail::PassModel&lt;llvm::Module, llvm::VerifierPass, llvm::AnalysisManager&lt;llvm::Module&gt;&gt;::run(llvm::Module&amp;, llvm::AnalysisManager&lt;llvm::Module&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e97cae)
 #<!-- -->9 0x00000000035afdd0 llvm::PassManager&lt;llvm::Module, llvm::AnalysisManager&lt;llvm::Module&gt;&gt;::run(llvm::Module&amp;, llvm::AnalysisManager&lt;llvm::Module&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x35afdd0)
#<!-- -->10 0x0000000003ea8dab (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr&lt;llvm::raw_pwrite_stream, std::default_delete&lt;llvm::raw_pwrite_stream&gt;&gt;&amp;, std::unique_ptr&lt;llvm::ToolOutputFile, std::default_delete&lt;llvm::ToolOutputFile&gt;&gt;&amp;, clang::BackendConsumer*) BackendUtil.cpp:0:0
#<!-- -->11 0x0000000003eac5d5 clang::EmitBackendOutput(clang::DiagnosticsEngine&amp;, clang::HeaderSearchOptions const&amp;, clang::CodeGenOptions const&amp;, clang::TargetOptions const&amp;, clang::LangOptions const&amp;, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;, std::unique_ptr&lt;llvm::raw_pwrite_stream, std::default_delete&lt;llvm::raw_pwrite_stream&gt;&gt;, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3eac5d5)
#<!-- -->12 0x0000000004577fce clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4577fce)
#<!-- -->13 0x000000000672463c clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x672463c)
#<!-- -->14 0x00000000045783b8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45783b8)
#<!-- -->15 0x0000000004833519 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4833519)
#<!-- -->16 0x00000000047b278e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47b278e)
#<!-- -->17 0x000000000491931e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x491931e)
#<!-- -->18 0x0000000000cea5af cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcea5af)
#<!-- -->19 0x0000000000ce226a ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) driver.cpp:0:0
#<!-- -->20 0x00000000045bb5b9 void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) Job.cpp:0:0
#<!-- -->21 0x0000000003b478c4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b478c4)
#<!-- -->22 0x00000000045bbbaf clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) Job.cpp:0:0
#<!-- -->23 0x0000000004581e9d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4581e9d)
#<!-- -->24 0x0000000004582f8d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4582f8d)
#<!-- -->25 0x000000000458a345 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x458a345)
#<!-- -->26 0x0000000000ce7449 clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce7449)
#<!-- -->27 0x0000000000bb3b54 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbb3b54)
#<!-- -->28 0x00007d0a1fc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->29 0x00007d0a1fc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->30 0x0000000000ce1d1e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce1d1e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70

It can be compiled without vector_size attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 crash Prefer [crash-on-valid] or [crash-on-invalid] new issue
Projects
None yet
Development

No branches or pull requests

3 participants