Skip to content

Commit c3fcfd2

Browse files
[swiftc (32 vs. 5544)] Add crasher in swift::Expr::walk(...)
Add test case for crash triggered in `swift::Expr::walk(...)`. Current number of unresolved compiler crashers: 32 (5544 resolved) /cc @DougGregor - just wanted to let you know that this crasher caused an assertion failure for the assertion `ty->getNominalOrBoundGenericNominal() || ty->is<DynamicSelfType>() || ty->isExistentialType() || ty->is<ArchetypeType>()` added on 2014-02-25 by you in commit 6a532e0 :-) Assertion failure in [`lib/Sema/CSApply.cpp (line 7121)`](https://github.com/apple/swift/blob/5c1859e98aca8d6292fb4f7563d47fd2856b7715/lib/Sema/CSApply.cpp#L7121): ``` Assertion `ty->getNominalOrBoundGenericNominal() || ty->is<DynamicSelfType>() || ty->isExistentialType() || ty->is<ArchetypeType>()' failed. When executing: swift::Expr *(anonymous namespace)::ExprRewriter::finishApply(swift::ApplyExpr *, swift::Type, swift::constraints::ConstraintLocatorBuilder) ``` Assertion context: ```c++ } // We're constructing a value of nominal type. Look for the constructor or // enum element to use. assert(ty->getNominalOrBoundGenericNominal() || ty->is<DynamicSelfType>() || ty->isExistentialType() || ty->is<ArchetypeType>()); auto ctorLocator = cs.getConstraintLocator( locator.withPathElement(ConstraintLocator::ApplyFunction) .withPathElement(ConstraintLocator::ConstructorMember)); auto selected = getOverloadChoiceIfAvailable(ctorLocator); ``` Stack trace: ``` 0 0x0000000003a5f2b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3a5f2b8) 1 0x0000000003a5f9f6 SignalHandler(int) (/path/to/swift/bin/swift+0x3a5f9f6) 2 0x00007f45d9d9b390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390) 3 0x00007f45d82c1428 gsignal /build/glibc-9tT8Do/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0 4 0x00007f45d82c302a abort /build/glibc-9tT8Do/glibc-2.23/stdlib/abort.c:91:0 5 0x00007f45d82b9bd7 __assert_fail_base /build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0 6 0x00007f45d82b9c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82) 7 0x00000000013d899e (/path/to/swift/bin/swift+0x13d899e) 8 0x00000000013eeb93 (anonymous namespace)::ExprRewriter::visitApplyExpr(swift::ApplyExpr*) (/path/to/swift/bin/swift+0x13eeb93) 9 0x00000000013d4294 (anonymous namespace)::ExprRewriter::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x13d4294) 10 0x00000000013d9a61 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x13d9a61) 11 0x000000000150b49c swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x150b49c) 12 0x00000000013d125f swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) (/path/to/swift/bin/swift+0x13d125f) 13 0x000000000132a7bd swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x132a7bd) 14 0x00000000014002fc (anonymous namespace)::FailureDiagnosis::typeCheckChildIndependently(swift::Expr*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<TCCFlags, unsigned int>, swift::ExprTypeCheckListener*, bool) (/path/to/swift/bin/swift+0x14002fc) 15 0x00000000013fd957 swift::ASTVisitor<(anonymous namespace)::FailureDiagnosis, bool, void, void, void, void, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13fd957) 16 0x00000000013f448b swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x13f448b) 17 0x00000000013fa2c9 swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x13fa2c9) 18 0x0000000001326d88 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) (/path/to/swift/bin/swift+0x1326d88) 19 0x000000000132a6c2 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x132a6c2) 20 0x000000000132e814 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*, bool) (/path/to/swift/bin/swift+0x132e814) 21 0x000000000132ea76 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int, bool) (/path/to/swift/bin/swift+0x132ea76) 22 0x0000000001347158 validatePatternBindingEntries(swift::TypeChecker&, swift::PatternBindingDecl*) (/path/to/swift/bin/swift+0x1347158) 23 0x0000000001343428 swift::TypeChecker::validateDecl(swift::ValueDecl*) (/path/to/swift/bin/swift+0x1343428) 24 0x000000000143201a swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) (/path/to/swift/bin/swift+0x143201a) 25 0x000000000134887c swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) (/path/to/swift/bin/swift+0x134887c) 26 0x0000000001351f0e (anonymous namespace)::DeclChecker::visitStructDecl(swift::StructDecl*) (/path/to/swift/bin/swift+0x1351f0e) 27 0x0000000001341414 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x1341414) 28 0x000000000135316b (anonymous namespace)::DeclChecker::visitProtocolDecl(swift::ProtocolDecl*) (/path/to/swift/bin/swift+0x135316b) 29 0x0000000001341434 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x1341434) 30 0x0000000001341333 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) (/path/to/swift/bin/swift+0x1341333) 31 0x00000000013cba85 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x13cba85) 32 0x0000000000f93106 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf93106) 33 0x00000000004aaa09 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) (/path/to/swift/bin/swift+0x4aaa09) 34 0x00000000004a8f9c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a8f9c) 35 0x00000000004655c7 main (/path/to/swift/bin/swift+0x4655c7) 36 0x00007f45d82ac830 __libc_start_main /build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0 37 0x0000000000462c69 _start (/path/to/swift/bin/swift+0x462c69) ```
1 parent 5c1859e commit c3fcfd2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See https://swift.org/LICENSE.txt for license information
6+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// REQUIRES: asserts
9+
// RUN: not --crash %target-swift-frontend %s -emit-ir
10+
@objc protocol P{struct B{var f=_=a{}}class a{}typealias a

0 commit comments

Comments
 (0)