[llvm-bugs] [Bug 51372] New: [11/12] clang frontend crash

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 5 19:37:07 PDT 2021


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

            Bug ID: 51372
           Summary: [11/12] clang frontend crash
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anbu1024.me at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

$ cat test.c 

enum E e;

void foo(void)
{
    double d[e];
}

----------------------------------------------------------------

$ clang-1201 --version
clang version 12.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path-to-llvm/12.0.1/install/bin

----------------------------------------------------------------

$ clang-1201 test.c
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /path-to-llvm/12.0.1/install/bin/clang-12 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations
-disable-free -disable-llvm-verifier -discard-value-names -main-file-name
test.c -mrelocation-model static -mframe-pointer=all -fmath-errno
-fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64
-tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/path-to-llvm/12.0.1/install/lib/clang/12.0.1 -internal-isystem
/usr/local/include -internal-isystem
/path-to-llvm/12.0.1/install/lib/clang/12.0.1/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdebug-compilation-dir /path-to-code
-ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -o
/tmp/test-6847e5.o -x c test.c
1.      <eof> parser at end of file
2.      test.c:4:6: LLVM IR generation of declaration 'foo'
3.      test.c:4:6: Generating code for declaration 'foo'
 #0 0x0000563678092b01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x1ccbb01)
 #1 0x00005636780908c4 llvm::sys::RunSignalHandlers()
(/path-to-llvm/12.0.1/install/bin/clang-12+0x1cc98c4)
 #2 0x0000563678090a3b SignalHandler(int)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x1cc9a3b)
 #3 0x00007f18205783c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x00005636786664ef hasBooleanRepresentation(clang::QualType)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x229f4ef)
 #5 0x0000563678669339
clang::CodeGen::CodeGenFunction::EmitFromMemory(llvm::Value*, clang::QualType)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x22a2339)
 #6 0x000056367867797f
clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(clang::CodeGen::Address,
bool, clang::QualType, clang::SourceLocation, clang::CodeGen::LValueBaseInfo,
clang::CodeGen::TBAAAccessInfo, bool)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x22b097f)
 #7 0x0000563678679bd5
clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(clang::CodeGen::LValue,
clang::SourceLocation) (/path-to-llvm/12.0.1/install/bin/clang-12+0x22b2bd5)
 #8 0x00005636786c7f63 (anonymous
namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2300f63)
 #9 0x00005636786c5be2 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x22febe2)
#10 0x00005636786cb738 (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2304738)
#11 0x00005636786c4cd0 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x22fdcd0)
#12 0x00005636786c5f37
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x22fef37)
#13 0x000056367840c261
clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(clang::QualType)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2045261)
#14 0x000056367864ed78
clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2287d78)
#15 0x000056367864f9ff
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x22889ff)
#16 0x000056367864fd52 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&) (.localalias) (/path-to-llvm/12.0.1/install/bin/clang-12+0x2288d52)
#17 0x00005636783a497f
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x1fdd97f)
#18 0x00005636783b52d9
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*,
llvm::ArrayRef<clang::Attr const*>)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x1fee2d9)
#19 0x00005636783b0036 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x1fe9036)
#20 0x00005636783b06d2
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x1fe96d2)
#21 0x0000563678406efa
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x203fefa)
#22 0x000056367841255e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x204b55e)
#23 0x0000563678461077
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/path-to-llvm/12.0.1/install/bin/clang-12+0x209a077)
#24 0x000056367845ea95
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/path-to-llvm/12.0.1/install/bin/clang-12+0x2097a95)
#25 0x000056367845ef63
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2097f63)
#26 0x0000563678464ec9
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x209dec9)
#27 0x000056367903ea01 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2c77a01)
#28 0x000056367903261d
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2c6b61d)
#29 0x0000563679e19734 clang::ParseAST(clang::Sema&, bool, bool)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x3a52734)
#30 0x000056367903c146 clang::CodeGenAction::ExecuteAction()
(/path-to-llvm/12.0.1/install/bin/clang-12+0x2c75146)
#31 0x00005636789bec31 clang::FrontendAction::Execute()
(/path-to-llvm/12.0.1/install/bin/clang-12+0x25f7c31)
#32 0x000056367895b99b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x259499b)
#33 0x0000563678a90ae0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/path-to-llvm/12.0.1/install/bin/clang-12+0x26c9ae0)
#34 0x0000563676ee11bb cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/path-to-llvm/12.0.1/install/bin/clang-12+0xb1a1bb)
#35 0x0000563676ede9cb ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/path-to-llvm/12.0.1/install/bin/clang-12+0xb179cb)
#36 0x0000563676e6176e main
(/path-to-llvm/12.0.1/install/bin/clang-12+0xa9a76e)
#37 0x00007f18200460b3 __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#38 0x0000563676ede55e _start
(/path-to-llvm/12.0.1/install/bin/clang-12+0xb1755e)
clang-12: error: unable to execute command: Segmentation fault (core dumped)
clang-12: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path-to-llvm/12.0.1/install/bin
clang-12: note: diagnostic msg: 
********************

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

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

----------------------------------------------------------------

$ clang-1100 --version
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
0160ad802e899c2922bc9b29564080c22eb0908c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin

----------------------------------------------------------------

$ clang-1100 test.c
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments:
/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name test.c
-mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64
-fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/lib/clang/11.0.0
-internal-isystem /usr/local/include -internal-isystem
/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/lib/clang/11.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /path-to-code -ferror-limit 19 -fgnuc-version=4.2.1
-fcolor-diagnostics -faddrsig -o /tmp/test-5690d2.o -x c test.c 
1.      <eof> parser at end of file
2.      test.c:4:6: LLVM IR generation of declaration 'foo'
3.      test.c:4:6: Generating code for declaration 'foo'
 #0 0x00000000022bcf44 PrintStackTraceSignalHandler(void*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x22bcf44)
 #1 0x00000000022bacce llvm::sys::RunSignalHandlers()
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x22bacce)
 #2 0x00000000022bd245 SignalHandler(int)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x22bd245)
 #3 0x00007f3d850da3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x00000000026ecba9 hasBooleanRepresentation(clang::QualType)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x26ecba9)
 #5 0x00000000026ed2d7
clang::CodeGen::CodeGenFunction::EmitFromMemory(llvm::Value*, clang::QualType)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x26ed2d7)
 #6 0x00000000026ec4b4
clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(clang::CodeGen::Address,
bool, clang::QualType, clang::SourceLocation, clang::CodeGen::LValueBaseInfo,
clang::CodeGen::TBAAAccessInfo, bool)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x26ec4b4)
 #7 0x00000000026ebcc7
clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(clang::CodeGen::LValue,
clang::SourceLocation)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x26ebcc7)
 #8 0x000000000271d9cc clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x271d9cc)
 #9 0x0000000002721d8b (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x2721d8b)
#10 0x000000000270f982
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x270f982)
#11 0x00000000025179a5
clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(clang::QualType)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x25179a5)
#12 0x00000000026c4f6c
clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x26c4f6c)
#13 0x00000000026c21ea
clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x26c21ea)
#14 0x00000000026c1f39 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x26c1f39)
#15 0x00000000024c4b0c
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x24c4b0c)
#16 0x00000000024c41fe clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x24c41fe)
#17 0x00000000024ce580
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x24ce580)
#18 0x0000000002517c48
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x2517c48)
#19 0x00000000025184fc
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x25184fc)
#20 0x0000000002531c5c
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x2531c5c)
#21 0x000000000252bea2
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x252bea2)
#22 0x0000000002534b75
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x2534b75)
#23 0x0000000002f4010f (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x2f4010f)
#24 0x0000000002f3d6c2
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x2f3d6c2)
#25 0x00000000039300d4 clang::ParseAST(clang::Sema&, bool, bool)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x39300d4)
#26 0x00000000029c4727 clang::FrontendAction::Execute()
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x29c4727)
#27 0x00000000029607c1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x29607c1)
#28 0x0000000002a5d12a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x2a5d12a)
#29 0x00000000009babc7 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x9babc7)
#30 0x00000000009b8eb1 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x9b8eb1)
#31 0x00000000009b8cb7 main
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x9b8cb7)
#32 0x00007f3d84b4f0b3 __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#33 0x00000000009b5f4e _start
(/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-11+0x9b5f4e)
clang-11: error: unable to execute command: Segmentation fault (core dumped)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
0160ad802e899c2922bc9b29564080c22eb0908c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/path-to-llvm/11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin
clang-11: note: diagnostic msg: 
********************

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

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

-- 
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/20210806/b588dfeb/attachment-0001.html>


More information about the llvm-bugs mailing list