Assertion `is<T>() && "Invalid accessor called"' failed.
| Bugzilla Link | 44268 |
| Resolution | FIXED |
| Resolved on | Dec 13, 2019 18:42 |
| Version | trunk |
| OS | Linux |
| Attachments | Code to reproduce the issue. |
| CC | @DougGregor,@zygoloid,@stephenhines |
Extended Description
We have been testing new LLVM version (4e8231b5cf0) on ChromeOS, and is currently blocked by http://crbug.com/1032828. Essentially all our builds with the new LLVM version being tested failed to build net-libs/libproxy:
libproxy-0.4.13-r2: clang-10: /var/tmp/portage/sys-devel/llvm-10.0_pre370808_p20191029-r6/work/llvm-10.0_pre370808_p20191029/llvm/include/llvm/ADT/PointerUnion.h:195: T llvm::PointerUnion<const clang::ValueDecl *, const clang::Expr *, clang::TypeInfoLValue, clang::DynamicAllocLValue>::get() const [PTs = <const clang::ValueDecl *, const clang::Expr *, clang::TypeInfoLValue, clang::DynamicAllocLValue>, T = const clang::Expr *]: Assertion `is
Call stack is as follows,
libproxy-0.4.13-r2: 1. ../../libproxy-0.4.13/libproxy/url.cpp:81:10 <Spelling=../../libproxy-0.4.13/libproxy/url.cpp:77:83>: current parser token ')' libproxy-0.4.13-r2: 2. ../../libproxy-0.4.13/libproxy/url.cpp:78:63: parsing function body 'copyaddr' libproxy-0.4.13-r2: 3. ../../libproxy-0.4.13/libproxy/url.cpp:78:63: in compound statement ('{}') libproxy-0.4.13-r2: 4. ../../libproxy-0.4.13/libproxy/url.cpp:79:26: in compound statement ('{}') libproxy-0.4.13-r2: #0 0x000000000420f3a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/bin/clang-10+0x420f3a8) libproxy-0.4.13-r2: #1 0x000000000420ce70 llvm::sys::RunSignalHandlers() (/usr/bin/clang-10+0x420ce70) libproxy-0.4.13-r2: #2 0x000000000420fa8f (/usr/bin/clang-10+0x420fa8f) libproxy-0.4.13-r2: #3 0x00007f5bd5c5f540 __restore_rt (/lib64/libpthread.so.0+0x12540) libproxy-0.4.13-r2: #4 0x00007f5bd5153d31 raise (/lib64/libc.so.6+0x35d31) libproxy-0.4.13-r2: #5 0x00007f5bd5155a41 abort (/lib64/libc.so.6+0x37a41) libproxy-0.4.13-r2: #6 0x00007f5bd514c437 (/lib64/libc.so.6+0x2e437) libproxy-0.4.13-r2: #7 0x00007f5bd514c4e2 (/lib64/libc.so.6+0x2e4e2) libproxy-0.4.13-r2: #8 0x0000000006907e30 (/usr/bin/clang-10+0x6907e30) libproxy-0.4.13-r2: #9 0x00000000069513ad (/usr/bin/clang-10+0x69513ad) libproxy-0.4.13-r2: #10 0x00000000069015b9 (/usr/bin/clang-10+0x69015b9) libproxy-0.4.13-r2: #11 0x0000000006935295 (/usr/bin/clang-10+0x6935295) libproxy-0.4.13-r2: #12 0x00000000069015b9 (/usr/bin/clang-10+0x69015b9) libproxy-0.4.13-r2: #13 0x0000000006905328 clang::Expr::EvaluateWithSubstitution(clang::APValue&, clang::ASTContext&, clang::FunctionDecl const*, llvm::ArrayRef<clang::Expr const*>, clang::Expr const*) const (/usr/bin/clang-10+0x6905328) libproxy-0.4.13-r2: #14 0x00000000063aa2ad clang::Sema::diagnoseArgDependentDiagnoseIfAttrs(clang::FunctionDecl const*, clang::Expr const*, llvm::ArrayRef<clang::Expr const*>, clang::SourceLocation) (/usr/bin/clang-10+0x63aa2ad) libproxy-0.4.13-r2: #15 0x0000000005e34acd clang::Sema::checkCall(clang::NamedDecl*, clang::FunctionProtoType const*, clang::Expr const*, llvm::ArrayRef<clang::Expr const*>, bool, clang::SourceLocation, clang::SourceRange, clang::Sema::VariadicCallType) (/usr/bin/clang-10+0x5e34acd) libproxy-0.4.13-r2: #16 0x0000000005e35d88 clang::Sema::CheckFunctionCall(clang::FunctionDecl*, clang::CallExpr*, clang::FunctionProtoType const*) (/usr/bin/clang-10+0x5e35d88) libproxy-0.4.13-r2: #17 0x0000000006141b05 clang::Sema::BuildResolvedCallExpr(clang::Expr*, clang::NamedDecl*, clang::SourceLocation, llvm::ArrayRefclang::Expr*, clang::SourceLocation, clang::Expr*, bool, clang::CallExpr::ADLCallKind) (/usr/bin/clang-10+0x6141b05) libproxy-0.4.13-r2: #18 0x00000000063be598 (/usr/bin/clang-10+0x63be598) libproxy-0.4.13-r2: #19 0x00000000063bdc61 clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRefclang::Expr*, clang::SourceLocation, clang::Expr*, bool, bool) (/usr/bin/clang-10+0x63bdc61) libproxy-0.4.13-r2: #20 0x000000000612468a clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRefclang::Expr*, clang::SourceLocation, clang::Expr*, bool) (/usr/bin/clang-10+0x612468a) libproxy-0.4.13-r2: #21 0x000000000613fa28 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRefclang::Expr*, clang::SourceLocation, clang::Expr*) (/usr/bin/clang-10+0x613fa28) libproxy-0.4.13-r2: #22 0x0000000005cdeb39 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/usr/bin/clang-10+0x5cdeb39) libproxy-0.4.13-r2: #23 0x0000000005ce0e6f clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) (/usr/bin/clang-10+0x5ce0e6f) libproxy-0.4.13-r2: #24 0x0000000005cdda9b clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) (/usr/bin/clang-10+0x5cdda9b) libproxy-0.4.13-r2: #25 0x0000000005ce3e93 clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtrclang::QualType&, clang::SourceLocation&) (/usr/bin/clang-10+0x5ce3e93) libproxy-0.4.13-r2: #26 0x0000000005ce0738 clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) (/usr/bin/clang-10+0x5ce0738) libproxy-0.4.13-r2: #27 0x0000000005cdb80b clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/usr/bin/clang-10+0x5cdb80b) libproxy-0.4.13-r2: #28 0x0000000005c9c025 clang::Parser::ParseReturnStatement() (/usr/bin/clang-10+0x5c9c025) libproxy-0.4.13-r2: #29 0x0000000005c955f4 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/bin/clang-10+0x5c955f4) libproxy-0.4.13-r2: #30 0x0000000005c94b2b clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/bin/clang-10+0x5c94b2b) libproxy-0.4.13-r2: #31 0x0000000005c976a4 clang::Parser::ParseCaseStatement(clang::Parser::ParsedStmtContext, bool, clang::ActionResult<clang::Expr*, true>) (/usr/bin/clang-10+0x5c976a4) libproxy-0.4.13-r2: #32 0x0000000005c9576b clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/bin/clang-10+0x5c9576b) libproxy-0.4.13-r2: #33 0x0000000005c94b2b clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/bin/clang-10+0x5c94b2b) libproxy-0.4.13-r2: #34 0x0000000005c9e4c2 clang::Parser::ParseCompoundStatementBody(bool) (/usr/bin/clang-10+0x5c9e4c2) libproxy-0.4.13-r2: #35 0x0000000005c9d2b6 clang::Parser::ParseCompoundStatement(bool, unsigned int) (/usr/bin/clang-10+0x5c9d2b6) libproxy-0.4.13-r2: #36 0x0000000005c95550 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/bin/clang-10+0x5c95550) libproxy-0.4.13-r2: #37 0x0000000005c94b2b clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/bin/clang-10+0x5c94b2b) libproxy-0.4.13-r2: #38 0x0000000005c992cf clang::Parser::ParseSwitchStatement(clang::SourceLocation*) (/usr/bin/clang-10+0x5c992cf) libproxy-0.4.13-r2: #39 0x0000000005c95539 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/bin/clang-10+0x5c95539) libproxy-0.4.13-r2: #40 0x0000000005c94b2b clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/bin/clang-10+0x5c94b2b) libproxy-0.4.13-r2: #41 0x0000000005c9e4c2 clang::Parser::ParseCompoundStatementBody(bool) (/usr/bin/clang-10+0x5c9e4c2) libproxy-0.4.13-r2: #42 0x0000000005c9f8a2 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/bin/clang-10+0x5c9f8a2) libproxy-0.4.13-r2: #43 0x0000000005c796f5 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/bin/clang-10+0x5c796f5) libproxy-0.4.13-r2: #44 0x0000000005cc6c3a clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/bin/clang-10+0x5cc6c3a) libproxy-0.4.13-r2: #45 0x0000000005c78655 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/bin/clang-10+0x5c78655) libproxy-0.4.13-r2: #46 0x0000000005c77f4d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/bin/clang-10+0x5c77f4d) libproxy-0.4.13-r2: #47 0x0000000005c76ef7 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/bin/clang-10+0x5c76ef7) libproxy-0.4.13-r2: #48 0x0000000005c74f2d clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&, bool) (/usr/bin/clang-10+0x5c74f2d) libproxy-0.4.13-r2: #49 0x0000000005c6eecd clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/clang-10+0x5c6eecd) libproxy-0.4.13-r2: #50 0x0000000004ab79d3 clang::FrontendAction::Execute() (/usr/bin/clang-10+0x4ab79d3) libproxy-0.4.13-r2: #51 0x0000000004a1c552 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/clang-10+0x4a1c552) libproxy-0.4.13-r2: #52 0x0000000004b85985 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/clang-10+0x4b85985) libproxy-0.4.13-r2: #53 0x0000000002c5af71 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-10+0x2c5af71) libproxy-0.4.13-r2: #54 0x0000000002c58303 main (/usr/bin/clang-10+0x2c58303) libproxy-0.4.13-r2: #55 0x00007f5bd513fa8e __libc_start_main (/lib64/libc.so.6+0x21a8e)
We did some testing and it seemed da1b4347e41 caused this issue.
commit da1b4347e41aa5bf76cb2151318bf5917bc9ee99 (HEAD) Author: Richard Smith [email protected] Date: Fri Sep 27 01:26:47 2019 +0000
For P0784R7: Add support for dynamic allocation with new / delete during
constant evaluation.
llvm-svn: 373036
I have attached a minimal code (repro) and a script (repro_script) to reproduces the reported issue. The code is not complete and compiling it will cause some unrelated warnings and errors but they can be safely ignored.
Reduced to:
int b(void *c) attribute((enable_if(__builtin_object_size(c, 0), ""))); int a = b(new int);
or:
constexpr int f() {
void *c = new int;
return __builtin_object_size(c, 0);
}
Fixed in llvmorg-10-init-11960-gc5b890e9224
repro_script:
#!/bin/bash -u /path/to/clang -cc1 -x c++ repro
assigned to @zygoloid