Skip to content

A crash when compiling #8963

New issue

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

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

Already on GitHub? # to your account

Closed
drhaozhong opened this issue Apr 6, 2023 · 2 comments
Closed

A crash when compiling #8963

drhaozhong opened this issue Apr 6, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@drhaozhong
Copy link

The code is as follows:

extern struct S v, s; struct S { int t; int p[]; } v = { 4, 0 };

When compiling the above code, I received the following messages:

clang++: /usr/lib/compiler/icc/llvm/clang/lib/CodeGen/CodeGenModule.cpp:5499: void clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(const clang::VarDecl*, bool): Assertion `VarSize == CstSize && "Emitted constant has unexpected size"' failed.
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: /usr/lib/compiler/icc/llvm/build/bin/clang++ -c /home/haozhong/project/approach/otherreport/gcc/tmp/gcc_71685/code0.c.cpp
1. parser at end of file
2. /home/haozhong/project/approach/otherreport/gcc/tmp/gcc_71685/code0.c.cpp:2:8: LLVM IR generation of declaration 'S'
3. /home/haozhong/project/approach/otherreport/gcc/tmp/gcc_71685/code0.c.cpp:2:30: Generating code for declaration 'v'
#0 0x0000556f23a87e92 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x2210e92)
#1 0x0000556f23a856ff llvm::sys::RunSignalHandlers() (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x220e6ff)
#2 0x0000556f239e6708 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f2ee643bcf0 (/lib/x86_64-linux-gnu/libc.so.6+0x3bcf0)
#4 0x00007f2ee649226b pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9226b)
#5 0x00007f2ee643bc46 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3bc46)
#6 0x00007f2ee64227fc abort (/lib/x86_64-linux-gnu/libc.so.6+0x227fc)
#7 0x00007f2ee642271b (/lib/x86_64-linux-gnu/libc.so.6+0x2271b)
#8 0x00007f2ee6433596 (/lib/x86_64-linux-gnu/libc.so.6+0x33596)
#9 0x0000556f23e53c0e clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*, bool) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x25dcc0e)
#10 0x0000556f23e68f21 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x25f1f21)
#11 0x0000556f23e72313 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#12 0x0000556f24ce8b73 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#13 0x0000556f24cda369 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x3463369)
#14 0x0000556f25df9ed3 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x4582ed3)
#15 0x0000556f24ce6149 clang::CodeGenAction::ExecuteAction() (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x346f149)
#16 0x0000556f2457de11 clang::FrontendAction::Execute() (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x2d06e11)
#17 0x0000556f244fc3ee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x2c853ee)
#18 0x0000556f24652571 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x2ddb571)
#19 0x0000556f226b8b94 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0xe41b94)
#20 0x0000556f226b4e57 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x0000556f2433034d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optionalllvm::StringRef>, std::__cxx11::basic_string<char, std::char_traits, std::allocator>, bool) const::'lambda'()>(long) Job.cpp:0:0
#22 0x0000556f239e6bce llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x216fbce)
#23 0x0000556f24333164 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optionalllvm::StringRef>, std::__cxx11::basic_string<char, std::char_traits, std::allocator>, bool) const (.part.0) Job.cpp:0:0
#24 0x0000556f242c6bcf clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x2a4fbcf)
#25 0x0000556f242c76de clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x2a506de)
#26 0x0000556f242d7e8c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0x2a60e8c)
#27 0x0000556f226b74b1 clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/compiler/icc/llvm/build/bin/clang+++0xe404b1)
#28 0x0000556f226054f3 main (/usr/lib/compiler/icc/llvm/build/bin/clang+++0xd8e4f3)
#29 0x00007f2ee6423510 (/lib/x86_64-linux-gnu/libc.so.6+0x23510)
#30 0x00007f2ee64235c9 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x235c9)
#31 0x0000556f226af2e5 _start (/usr/lib/compiler/icc/llvm/build/bin/clang+++0xe382e5)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 17.0.0 (https://github.com/intel/llvm cb6c058)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/compiler/icc/llvm/build/bin
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/code0-3620fd.cpp
clang++: note: diagnostic msg: /tmp/code0-3620fd.sh
clang++: note: diagnostic msg: 
@drhaozhong drhaozhong added the bug Something isn't working label Apr 6, 2023
@drhaozhong
Copy link
Author

The following code also causes crashes:

struct Foo { int i; char a[]; } foo = { 1, "" }; // No warning struct Bar { int i; char a[]; } bar = { 1, {0} }; // Warning

@dm-vodopyanov
Copy link
Contributor

Closing due to #8967 (comment)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants