CTSRD-CHERI / clang

DO NOT USE. Use llvm-project instead
Other
9 stars 8 forks source link

assertion compiling lib/libopenbsd #193

Closed brooksdavis closed 6 years ago

brooksdavis commented 6 years ago

Jenkins is hitting an assertion I've been unable to reproduce locally:

Assertion failed: (I.getBitWidth() == Info.Ctx.getIntWidth(E->getType()) && "Invalid evaluation result."), function Success, file /usr/local/jenkins/workspace/CLANG-LLVM-master/CPU/cheri-multi/label/freebsd/llvm/tools/clang/lib/AST/ExprConstant.cpp, line 7011.
0  clang-7.0 0x0000000002e92e18 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  clang-7.0 0x0000000002e931e6 __assert + 86
2  clang-7.0 0x000000000489e5c5 llvm::SmallVectorImpl<clang::CXXRecordDecl const*>::operator=(llvm::SmallVectorImpl<clang::CXXRecordDecl const*>&&) + 127749
3  clang-7.0 0x000000000489c3be llvm::SmallVectorImpl<clang::CXXRecordDecl const*>::operator=(llvm::SmallVectorImpl<clang::CXXRecordDecl const*>&&) + 119038
4  clang-7.0 0x0000000004868280 clang::Expr::EvaluateWithSubstitution(clang::APValue&, clang::ASTContext&, clang::FunctionDecl const*, llvm::ArrayRef<clang::Expr const*>, clang::Expr const*) const + 2640
5  clang-7.0 0x00000000048638d1 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&, clang::ASTContext const&) const + 1137
6  clang-7.0 0x0000000004863590 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&, clang::ASTContext const&) const + 304
7  clang-7.0 0x00000000048667ae clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 1038
8  clang-7.0 0x0000000004866ce4 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 2372
9  clang-7.0 0x00000000048668db clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 1339
10 clang-7.0 0x0000000004866ce4 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 2372
11 clang-7.0 0x00000000048668db clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 1339
12 clang-7.0 0x0000000004866ce4 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 2372
13 clang-7.0 0x00000000048668b6 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 1302
14 clang-7.0 0x0000000004866ce4 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 2372
15 clang-7.0 0x0000000004866ce4 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 2372
16 clang-7.0 0x00000000048668db clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 1339
17 clang-7.0 0x00000000048668b6 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 1302
18 clang-7.0 0x00000000048663c3 clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const + 35
19 clang-7.0 0x00000000048578b9 clang::Expr::isNullPointerConstant(clang::ASTContext&, clang::Expr::NullPointerConstantValueDependence) const + 1257
20 clang-7.0 0x0000000003ec77bd clang::Sema::CheckAddressOfPackedMember(clang::Expr*) + 5693
21 clang-7.0 0x00000000040ec651 clang::Sema::CheckBooleanCondition(clang::SourceLocation, clang::Expr*, bool) + 465
22 clang-7.0 0x00000000040ec869 clang::Sema::ActOnCondition(clang::Scope*, clang::SourceLocation, clang::Expr*, clang::Sema::ConditionKind) + 121
23 clang-7.0 0x0000000003c6aadb clang::Parser::ParseParenExprOrCondition(clang::ActionResult<clang::Stmt*, true>*, clang::Sema::ConditionResult&, clang::SourceLocation, clang::Sema::ConditionKind) + 283
24 clang-7.0 0x0000000003c660a0 clang::Parser::ParseIfStatement(clang::SourceLocation*) + 608
25 clang-7.0 0x0000000003c63ea4 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) + 1780
26 clang-7.0 0x0000000003c63651 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) + 161
27 clang-7.0 0x0000000003c646b7 clang::Parser::ParseLabeledStatement(clang::Parser::ParsedAttributesWithRange&) + 359
28 clang-7.0 0x0000000003c63ab6 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) + 774
29 clang-7.0 0x0000000003c63651 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) + 161
30 clang-7.0 0x0000000003c6a6c9 clang::Parser::ParseCompoundStatementBody(bool) + 1497
31 clang-7.0 0x0000000003c6afbb clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) + 171
32 clang-7.0 0x0000000003be6093 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) + 2051
33 clang-7.0 0x0000000003c1b409 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2169
34 clang-7.0 0x0000000003be5575 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 821
35 clang-7.0 0x0000000003be4f16 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) + 422
36 clang-7.0 0x0000000003be3b37 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 2519
37 clang-7.0 0x0000000003be2adc clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 588
38 clang-7.0 0x0000000003bde4d6 clang::ParseAST(clang::Sema&, bool, bool) + 438
39 clang-7.0 0x00000000034b2edc clang::FrontendAction::Execute() + 76
40 clang-7.0 0x0000000003442d21 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1233
41 clang-7.0 0x0000000003537587 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1671
42 clang-7.0 0x000000000180ac7c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1308
43 clang-7.0 0x0000000001808d24 main + 10388
44 clang-7.0 0x000000000180617f _start + 383
0  clang-7.0   0x0000000002e92e18 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  clang-7.0   0x0000000002e934a6 llvm::sys::PrintStackTraceOnErrorSignal(llvm::StringRef, bool) + 678
2  libthr.so.3 0x0000000804c6478f pthread_sigmask + 1279
3  libthr.so.3 0x0000000804c63d6f pthread_getspecific + 3743
Stack dump:
0.  Program arguments: /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/sdk/bin/clang-7.0 -cc1 -triple mips64-unknown-freebsd12.0 -emit-obj -disable-free -main-file-name imsg.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu mips4 -target-feature -noabicalls -target-feature +soft-float -target-abi n64 -msoft-float -mfloat-abi soft -mllvm -mips-ssection-threshold=0 -mllvm -cheri-cap-table=false -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2 -debugger-tuning=gdb -coverage-notes-file /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/obj/mips.mips64/usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/lib/libopenbsd/imsg.gcno -resource-dir /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/sdk/lib/clang/7.0.0 -dependency-file .depend.imsg.o -sys-header-deps -MT imsg.o -I /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/lib/libopenbsd -isysroot /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/obj/mips.mips64/usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/tmp -O2 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -std=gnu99 -fdebug-compilation-dir /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/obj/mips.mips64/usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/lib/libopenbsd -ferror-limit 19 -fmessage-length 0 -ftls-model=initial-exec -fobjc-runtime=gnustep -fdiagnostics-show-option -vectorize-loops -vectorize-slp -cheri-linker -o imsg.o -x c /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/lib/libopenbsd/imsg.c 
1.  /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/lib/libopenbsd/imsg.c:78:24: current parser token ')'
2.  /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/lib/libopenbsd/imsg.c:50:1: parsing function body 'imsg_read'
3.  /usr/local/jenkins/workspace/CheriBSD-allkernels-multi/BASE_ABI/n64/CPU/mips/ISA/vanilla/label/freebsd/src/lib/libopenbsd/imsg.c:50:1: in compound statement ('{}')
arichardson commented 6 years ago

Reduced test case:

// RUN: %clang_cc1 -triple mips64-unknown-freebsd12.0 -target-cpu mips4 -target-abi n64 -mllvm -cheri-cap-table=false -std=gnu99 -mstack-alignment=32 -fcolor-diagnostics -vectorize-loops -vectorize-slp -o - -O0 -O0 -emit-llvm  %s
int imsg_read() {
   return  __builtin_align_up ( 0, sizeof 1 ) / sizeof (int);
}