[llvm-bugs] [Bug 44758] New: Assertion `D.getASTContext().getLangOpts().CPlusPlus' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 2 18:26:50 PST 2020


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

            Bug ID: 44758
           Summary: Assertion `D.getASTContext().getLangOpts().CPlusPlus'
                    failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: changochen1 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

POC:
---
a() {struct {: ( {b (
---

Run script:
---
# Crash reproducer for clang version 11.0.0
(https://github.com/llvm/llvm-project.git
56b7f595d2b402ff177ca42214325c8fdea10fb0)
# Driver args: "-x" "c" "-o" "/dev/null" "test1.c"
# Original command:  "/home/rxz226/llvm-project/bld_instru/bin/clang-11" "-cc1"
"-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-resource-dir"
"/home/rxz226/llvm-project/bld_instru/lib/clang/11.0.0" "-internal-isystem"
"/usr/local/include" "-internal-isystem"
"/home/rxz226/llvm-project/bld_instru/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"
"/home/rxz226/fuzzing/2020-02-02/clang/hangs/test" "-ferror-limit" "19"
"-fmessage-length" "0" "-fgnuc-version=4.2.1" "-fobjc-runtime=gcc"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-faddrsig" "-o"
"/tmp/test1-1e59a4.o" "-x" "c" "test1.c"
 "/home/rxz226/llvm-project/bld_instru/bin/clang-11" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-faddrsig" "-x" "c" "test1-19e090.c"
---

Stack dump:
---
clang: /home/rxz226/llvm-project/clang/lib/AST/Decl.cpp:2065: bool
isDeclExternC(const T &) [T = clang::FunctionDecl]: Assertion
`D.getASTContext().getLangOpts().CPlusPlus' failed.
Stack dump:
0.      Program arguments: /home/rxz226/llvm-project/bld_instru/bin/clang -x c
-o /dev/null test1.c
1.      test1.c:1:19: current parser token 'b'
2.      test1.c:1:5: parsing function body 'a'
3.      test1.c:1:5: in compound statement ('{}')
4.      test1.c:1:6: parsing struct/union body ''
5.      test1.c:1:18: in compound statement ('{}')
 #0 0x000000000681faf6 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:560:7
 #1 0x000000000681ac5e llvm::sys::RunSignalHandlers()
/home/rxz226/llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #2 0x000000000681dd30 llvm::sys::CleanupOnSignal(unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:3
 #3 0x000000000662a5aa (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:80:5
 #4 0x000000000662a9e6
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:361:51
 #5 0x00007f74a81fc390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #6 0x00007f74a6d66428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #7 0x00007f74a6d6802a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #8 0x00007f74a6d5ebd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
 #9 0x00007f74a6d5ec82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#10 0x000000000e3263f6 /home/rxz226/llvm-project/clang/lib/AST/Decl.cpp:2065:5
#11 0x000000000c1688a2 bool
isIncompleteDeclExternC<clang::FunctionDecl>(clang::Sema&, clang::FunctionDecl
const*) /home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:6463:13
#12 0x000000000c13d913 clang::Sema::ActOnFunctionDeclarator(clang::Scope*,
clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*,
clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>,
bool&) /home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:9511:7
#13 0x000000000c12e334 clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
/home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:5731:11
#14 0x000000000c12ba81 clang::Sema::ActOnDeclarator(clang::Scope*,
clang::Declarator&)
/home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:5407:15
#15 0x000000000c0ed415
clang::Sema::ImplicitlyDefineFunction(clang::SourceLocation,
clang::IdentifierInfo&, clang::Scope*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:14346:41
#16 0x000000000c0e84da clang::Sema::ClassifyName(clang::Scope*,
clang::CXXScopeSpec&, clang::IdentifierInfo*&, clang::SourceLocation,
clang::Token const&, clang::CorrectionCandidateCallback*)
/home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:923:26
#17 0x000000000bbc51b0
clang::Parser::TryAnnotateName(clang::CorrectionCandidateCallback*)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1635:53
#18 0x000000000bd8b5a7
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:190:11
#19 0x000000000bd8aff1 clang::ParsedAttributesView::empty() const
/home/rxz226/llvm-project/clang/include/clang/Sema/ParsedAttr.h:0:0
#20 0x000000000bd8aff1
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:109:0
#21 0x000000000bd9f27e clang::Parser::ParseCompoundStatementBody(bool)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:1079:11
#22 0x000000000bd9cf64 clang::Parser::ParseScope::~ParseScope()
/home/rxz226/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#23 0x000000000bd9cf64 clang::Parser::ParseCompoundStatement(bool, unsigned
int) /home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:897:0
#24 0x000000000bca30e3
clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool,
bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:2654:16
#25 0x000000000bc9d74e
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:935:11
#26 0x000000000bc91a90
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool,
clang::Parser::TypeCastState, bool, bool*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:663:20
#27 0x000000000bc96cab
clang::Parser::ParseConstantExpressionInExprEvalContext(clang::Parser::TypeCastState)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:207:18
#28 0x000000000bc96deb
clang::EnterExpressionEvaluationContext::~EnterExpressionEvaluationContext()
/home/rxz226/llvm-project/clang/include/clang/Sema/Sema.h:0:0
#29 0x000000000bc96deb
clang::Parser::ParseConstantExpression(clang::Parser::TypeCastState)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:219:0
#30 0x000000000bc20c64 clang::ActionResult<clang::Expr*, true>::isInvalid()
const /home/rxz226/llvm-project/clang/include/clang/Sema/Ownership.h:0:0
#31 0x000000000bc20c64
clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&,
llvm::function_ref<void (clang::ParsingFieldDeclarator&)>)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:4178:0
#32 0x000000000bc2216f clang::ParsingDeclSpec::~ParsingDeclSpec()
/home/rxz226/llvm-project/clang/include/clang/Parse/RAIIObjectsForParser.h:0:0
#33 0x000000000bc2216f
clang::Parser::ParseStructUnionBody(clang::SourceLocation,
clang::TypeSpecifierType, clang::Decl*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:4282:0
#34 0x000000000bc60e0d
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1966:20
#35 0x000000000bc04059 clang::ParsedAttributesView::empty() const
/home/rxz226/llvm-project/clang/include/clang/Sema/ParsedAttr.h:0:0
...
---

-- 
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/20200203/bfbca21a/attachment-0001.html>


More information about the llvm-bugs mailing list