[llvm-bugs] [Bug 37145] New: Assertion `SizeSoFar == Layout->getSizeInBytes() && "Layout of constant struct may be incorrect!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 16 22:42:11 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37145

            Bug ID: 37145
           Summary: Assertion `SizeSoFar == Layout->getSizeInBytes() &&
                    "Layout of constant struct may be incorrect!"' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: shlei930 at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ clang-trunk -v
clang version 7.0.0 (trunk 328089)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

$ clang-trunk abc.c
clang-7.0:
/home/suhua/compilers/trunk/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2278:
void emitGlobalConstantStruct(const llvm::DataLayout&, const
llvm::ConstantStruct*, llvm::AsmPrinter&, const llvm::Constant*, uint64_t):
Assertion `SizeSoFar == Layout->getSizeInBytes() && "Layout of constant struct
may be incorrect!"' failed.
#0 0x000000000234769a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x234769a)
#1 0x000000000234570e llvm::sys::RunSignalHandlers()
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x234570e)
#2 0x0000000002345872 SignalHandler(int)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x2345872)
#3 0x00007fa4eee7a390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007fa4edbea428 gsignal
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007fa4edbec02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007fa4edbe2bd7 __assert_fail_base
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
#7 0x00007fa4edbe2c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000002ab173b emitGlobalConstantImpl(llvm::DataLayout const&,
llvm::Constant const*, llvm::AsmPrinter&, llvm::Constant const*, unsigned long)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x2ab173b)
#9 0x0000000002ab20b6 llvm::AsmPrinter::EmitGlobalVariable(llvm::GlobalVariable
const*) (/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x2ab20b6)
#10 0x0000000002aafb64 llvm::AsmPrinter::doFinalization(llvm::Module&)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x2aafb64)
#11 0x0000000001ea541b llvm::FPPassManager::doFinalization(llvm::Module&)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x1ea541b)
#12 0x0000000001eb04f7 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x1eb04f7)
#13 0x00000000024e9626 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x24e9626)
#14 0x00000000024eb4f3 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_delete<llvm::raw_pwrite_stream> >)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x24eb4f3)
#15 0x0000000002d4787b
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x2d4787b)
#16 0x0000000003246142 clang::ParseAST(clang::Sema&, bool, bool)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x3246142)
#17 0x0000000002d46ebf clang::CodeGenAction::ExecuteAction()
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x2d46ebf)
#18 0x00000000028d5816 clang::FrontendAction::Execute()
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x28d5816)
#19 0x00000000028aad5e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x28aad5e)
#20 0x000000000296912e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0x296912e)
#21 0x0000000000c9b1c8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0xc9b1c8)
#22 0x0000000000c1eefd main
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0xc1eefd)
#23 0x00007fa4edbd5830 __libc_start_main
/build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#24 0x0000000000c95e79 _start
(/home/suhua/compilers/trunk/root-clang/bin/clang-7.0+0xc95e79)
Stack dump:
0.      Program arguments: /home/suhua/compilers/trunk/root-clang/bin/clang-7.0
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name abc.c -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/home/suhua/compilers/trunk/root-clang/lib/clang/7.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.3.0/ -c-isystem
/home/suhua/disk/home/klee/include/klee -internal-isystem /usr/local/include
-internal-isystem
/home/suhua/compilers/trunk/root-clang/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/suhua/Documents/VPT/reduce/bug42 -ferror-limit 19
-fmessage-length 204 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/abc-a0a086.o -x c abc.c
1.      <eof> parser at end of file
2.      Code generation
clang-7.0: error: unable to execute command: Aborted
clang-7.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 328089)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-7.0: 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-7.0: note: diagnostic msg:
********************

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

********************

$ cat abc.c
typedef union {
  struct {};
  char s[100000000000];
} T;
T a = {};

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180417/e863bf91/attachment.html>


More information about the llvm-bugs mailing list