Skip to content

Commit c267d30

Browse files
[swiftc (30 vs. 5563)] Add crasher in swift::TypeChecker::resolveIdentifierType
Add test case for crash triggered in `swift::TypeChecker::resolveIdentifierType`. Current number of unresolved compiler crashers: 30 (5563 resolved) /cc @slavapestov - just wanted to let you know that this crasher caused an assertion failure for the assertion `memberType && "Received null dependent member type"` added on 2017-05-21 by you in commit 0eac6f0 :-) Assertion failure in [`lib/Sema/TypeCheckType.cpp (line 1389)`](https://github.com/apple/swift/blob/2808583c6af337325bcc791254c4d3b0a68d36b8/lib/Sema/TypeCheckType.cpp#L1389): ``` Assertion `memberType && "Received null dependent member type"' failed. When executing: swift::Type resolveNestedIdentTypeComponent(swift::TypeChecker &, swift::DeclContext *, swift::Type, swift::SourceRange, swift::ComponentIdentTypeRepr *, TypeResolutionOptions, bool, swift::GenericTypeResolver *, UnsatisfiedDependency *) ``` Assertion context: ```c++ // If the parent is a type parameter, the member is a dependent member, // and we skip much of the work below. if (parentTy->isTypeParameter()) { auto memberType = resolver->resolveDependentMemberType(parentTy, DC, parentRange, comp); assert(memberType && "Received null dependent member type"); return memberType; } // Phase 2: If a declaration has already been bound, use it. if (auto *typeDecl = comp->getBoundDecl()) { ``` Stack trace: ``` 0 0x0000000003a765e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3a765e8) 1 0x0000000003a76d26 SignalHandler(int) (/path/to/swift/bin/swift+0x3a76d26) 2 0x00007f6e95d11390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390) 3 0x00007f6e94236428 gsignal /build/glibc-bfm8X4/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0 4 0x00007f6e9423802a abort /build/glibc-bfm8X4/glibc-2.23/stdlib/abort.c:91:0 5 0x00007f6e9422ebd7 __assert_fail_base /build/glibc-bfm8X4/glibc-2.23/assert/assert.c:92:0 6 0x00007f6e9422ec82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82) 7 0x00000000013d1fda resolveIdentTypeComponent(swift::TypeChecker&, swift::DeclContext*, llvm::ArrayRef<swift::ComponentIdentTypeRepr*>, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) (/path/to/swift/bin/swift+0x13d1fda) 8 0x00000000013d1939 swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) (/path/to/swift/bin/swift+0x13d1939) 9 0x00000000013d26a8 (anonymous namespace)::TypeResolver::resolveType(swift::TypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>) (/path/to/swift/bin/swift+0x13d26a8) 10 0x00000000013d25ac swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) (/path/to/swift/bin/swift+0x13d25ac) 11 0x00000000013d0fb0 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) (/path/to/swift/bin/swift+0x13d0fb0) 12 0x0000000001383737 checkGenericFuncSignature(swift::TypeChecker&, swift::GenericSignatureBuilder*, swift::AbstractFunctionDecl*, swift::GenericTypeResolver&) (/path/to/swift/bin/swift+0x1383737) 13 0x00000000013832ec swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) (/path/to/swift/bin/swift+0x13832ec) 14 0x00000000013694ab (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) (/path/to/swift/bin/swift+0x13694ab) 15 0x00000000013552b4 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x13552b4) 16 0x00000000013572e4 swift::TypeChecker::validateDecl(swift::ValueDecl*) (/path/to/swift/bin/swift+0x13572e4) 17 0x0000000001355d72 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x1355d72) 18 0x000000000136704b (anonymous namespace)::DeclChecker::visitProtocolDecl(swift::ProtocolDecl*) (/path/to/swift/bin/swift+0x136704b) 19 0x0000000001355294 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x1355294) 20 0x0000000001355193 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) (/path/to/swift/bin/swift+0x1355193) 21 0x00000000013dff04 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x13dff04) 22 0x0000000000f9de7d swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf9de7d) 23 0x00000000004abe79 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) (/path/to/swift/bin/swift+0x4abe79) 24 0x00000000004aa419 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4aa419) 25 0x0000000000465697 main (/path/to/swift/bin/swift+0x465697) 26 0x00007f6e94221830 __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:325:0 27 0x0000000000462d39 _start (/path/to/swift/bin/swift+0x462d39) ```
1 parent 2808583 commit c267d30

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
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+
protocol b{{}class a<a{}func a:Self.a

0 commit comments

Comments
 (0)