[llvm-bugs] [Bug 49180] New: clang++ 11.0 segment fault

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 14 13:50:10 PST 2021


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

            Bug ID: 49180
           Summary: clang++ 11.0 segment fault
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhan3299 at purdue.edu
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Hi,

Here is a segment fault in clang++ frontend. My system is Ubuntu 18.04, x86-64.

The version of clang++ is version 11.0.0, and my apt-installed 6.0.0 also
crashed.

$ ./clang++ test.cc
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: /data/xxx/git/llvm-project/build/bin/clang-11 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name test.cc -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
/data/xxx/git/llvm-project/build/lib/clang/11.1.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/backward
-internal-isystem /usr/local/include -internal-isystem
/data/xxx/git/llvm-project/build/lib/clang/11.1.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /data/xxx/docker_share/clang
-ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions
-fcolor-diagnostics -faddrsig -o /tmp/test-160602.o -x c++ test.cc
1.      test.cc:7:4: current parser token ';'
2.      test.cc:1:12: parsing function body 'main'
3.      test.cc:1:12: in compound statement ('{}')
 #0 0x0000000006e97306 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:560:7
 #1 0x0000000006e9266e llvm::sys::RunSignalHandlers()
/home/xxx/data/git/llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #2 0x0000000006e97caa SignalHandler(int)
/home/xxx/data/git/llvm-project/llvm/lib/Support/Unix/Signals.inc:396:3
 #3 0x00007f47de7908a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #4 0x000000000f980465 clang::Stmt::getSourceRange() const
/home/xxx/data/git/llvm-project/clang/lib/AST/Stmt.cpp:0:3
 #5 0x000000000daee681 (anonymous
namespace)::InitListChecker::FillInEmptyInitForField(unsigned int,
clang::FieldDecl*, clang::InitializedEntity const&, clang::InitListExpr*,
bool&, bool) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaInit.cpp:693:39
 #6 0x000000000dad2a9f (anonymous
namespace)::InitListChecker::FillInEmptyInitializations(clang::InitializedEntity
const&, clang::InitListExpr*, bool&, clang::InitListExpr*, unsigned int, bool)
/home/xxx/data/git/llvm-project/clang/lib/Sema/SemaInit.cpp:816:13
 #7 0x000000000dad3957 (anonymous
namespace)::InitListChecker::FillInEmptyInitializations(clang::InitializedEntity
const&, clang::InitListExpr*, bool&, clang::InitListExpr*, unsigned int, bool)
/home/xxx/data/git/llvm-project/clang/lib/Sema/SemaInit.cpp:919:7
 #8 0x000000000da92579 (anonymous
namespace)::InitListChecker::InitListChecker(clang::Sema&,
clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, bool,
bool, bool) /home/xxx/data/git/llvm-project/clang/lib/Sema/SemaInit.cpp:961:9
 #9 0x000000000dac9890 diagnoseListInit(clang::Sema&, clang::InitializedEntity
const&, clang::InitListExpr*)
/home/xxx/data/git/llvm-project/clang/lib/Sema/SemaInit.cpp:8739:19
#10 0x000000000dabded6 clang::InitializationSequence::Diagnose(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::ArrayRef<clang::Expr*>)
/home/xxx/data/git/llvm-project/clang/lib/Sema/SemaInit.cpp:0:5
#11 0x000000000daad48a clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
/home/xxx/data/git/llvm-project/clang/lib/Sema/SemaInit.cpp:7805:5
#12 0x000000000cef4122 clang::Sema::AddInitializerToDecl(clang::Decl*,
clang::Expr*, bool)
/home/xxx/data/git/llvm-project/clang/lib/Sema/SemaDecl.cpp:12076:33
#13 0x000000000c8863c8
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:2329:15
#14 0x000000000c880fc7 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1986:9
#15 0x000000000c8739fc
clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool,
clang::Parser::ForRangeInit*, clang::SourceLocation*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1700:10
#16 0x000000000c873179
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:0:12
#17 0x000000000ca08d41
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:0:13
#18 0x000000000ca081a6
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:106:20
#19 0x000000000ca1c77e clang::Parser::ParseCompoundStatementBody(bool)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:1089:11
#20 0x000000000ca1f748 clang::ActionResult<clang::Stmt*, true>::isInvalid()
const /home/xxx/data/git/llvm-project/clang/include/clang/Sema/Ownership.h:0:0
#21 0x000000000ca1f748 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseStmt.cpp:2240:0
#22 0x000000000c833117
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1339:10
#23 0x000000000c88224e clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseDecl.cpp:1926:18
#24 0x000000000c83020d
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:0:10
#25 0x000000000c82e939
clang::Parser::ObjCDeclContextSwitch::~ObjCDeclContextSwitch()
/home/xxx/data/git/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#26 0x000000000c82e939
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:1116:0
#27 0x000000000c82c6a1
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:935:12
#28 0x000000000c827ecc
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:683:10
#29 0x000000000c826ccc
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/home/xxx/data/git/llvm-project/clang/lib/Parse/Parser.cpp:555:26
#30 0x000000000c81cf4a clang::ParseAST(clang::Sema&, bool, bool)
/home/xxx/data/git/llvm-project/clang/lib/Parse/ParseAST.cpp:157:15
#31 0x000000000861c2a2 clang::ASTFrontendAction::ExecuteAction()
/home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1059:1
#32 0x00000000099decd8 clang::CodeGenAction::ExecuteAction()
/home/xxx/data/git/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1184:28
#33 0x000000000861a51a clang::FrontendAction::Execute()
/home/xxx/data/git/llvm-project/clang/lib/Frontend/FrontendAction.cpp:954:10
#34 0x000000000854eaa7 llvm::Error::operator bool()
/home/xxx/data/git/llvm-project/llvm/include/llvm/Support/Error.h:0:0
#35 0x000000000854eaa7
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/xxx/data/git/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:984:0
#36 0x00000000088f183f clang::CompilerInstance::getFrontendOpts()
/home/xxx/data/git/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:0:0
#37 0x00000000088f183f
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/xxx/data/git/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:279:0
#38 0x0000000000b094cc llvm::TimeTraceScope::~TimeTraceScope()
/home/xxx/data/git/llvm-project/llvm/include/llvm/Support/TimeProfiler.h:0:0
#39 0x0000000000b094cc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/xxx/data/git/llvm-project/clang/tools/driver/cc1_main.cpp:241:0
#40 0x0000000000afaf3b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:330:12
#41 0x0000000000af6966 main
/home/xxx/data/git/llvm-project/clang/tools/driver/driver.cpp:407:12
#42 0x00007f47dd439b97 __libc_start_main
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#43 0x0000000000af38ea _start
(/data/xxx/git/llvm-project/build/bin/clang-11+0xaf38ea)
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.1.0 (https://github.com/llvm/llvm-project.git
1fdec59bffc11ae37eb51a1b9869f0696bfd5312)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/xxx/git/llvm-project/build/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-3d905d.cpp
clang-11: note: diagnostic msg: /tmp/test-3d905d.sh
clang-11: note: diagnostic msg:

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

$ cat /tmp/test-3d905d.cpp
# 1 "<built-in>"
# 1 "test.cc"
int main() {
  struct {
    int b;
    int &c;
  } d[] {
    __builtin_choose_expr(__builtin_constant_p(0), 0, &&e)
  };

  return 0;
}

$ cat /tmp/test-3d905d.sh
# Crash reproducer for clang version 11.1.0
(https://github.com/llvm/llvm-project.git
1fdec59bffc11ae37eb51a1b9869f0696bfd5312)
# Driver args: "--driver-mode=g++" "test.cc"
# Original command:  "/data/xxx/git/llvm-project/build/bin/clang-11" "-cc1"
"-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test.cc" "-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" "/data/xxx/git/llvm-project/build/lib/clang/11.1.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/data/xxx/git/llvm-project/build/lib/clang/11.1.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir"
"/data/xxx/docker_share/clang" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-o"
"/tmp/test-160602.o" "-x" "c++" "test.cc"
 "/data/xxx/git/llvm-project/build/bin/clang-11" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test.cc" "-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"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-x" "c++"
"test-3d905d.cpp"

-- 
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/20210214/2d209b9e/attachment-0001.html>


More information about the llvm-bugs mailing list