Skip to content

Commit dace490

Browse files
[swiftc] Add test case for crash triggered in swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const
Stack trace: ``` swift: /path/to/llvm/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<swift::SILFunctionType, const swift::TypeBase *>::doit(const From *) [To = swift::SILFunctionType, From = const swift::TypeBase *]: Assertion `Val && "isa<> used on a null pointer"' failed. 9 swift 0x0000000001096f1d swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const + 45 10 swift 0x000000000109156f swift::Type::subst(swift::ModuleDecl*, llvm::DenseMap<swift::TypeBase*, swift::Type, llvm::DenseMapInfo<swift::TypeBase*>, llvm::detail::DenseMapPair<swift::TypeBase*, swift::Type> >&, swift::OptionSet<swift::SubstFlags, unsigned int>) const + 111 13 swift 0x0000000000e8a11e swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 254 14 swift 0x0000000001087d46 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 150 15 swift 0x0000000001087c88 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40 16 swift 0x0000000001088486 swift::ProtocolConformance::getTypeWitness(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 6 17 swift 0x0000000000e8210f swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 1071 19 swift 0x0000000000eabdee swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158 21 swift 0x0000000000eacd04 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164 22 swift 0x0000000000eabcea swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42 27 swift 0x0000000000e47556 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150 30 swift 0x0000000000ea5a5a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346 31 swift 0x0000000000ea58be swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46 32 swift 0x0000000000ea6458 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136 34 swift 0x0000000000e6a9f4 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1300 35 swift 0x0000000000cbcedf swift::CompilerInstance::performSema() + 3087 37 swift 0x000000000078b6ff frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495 38 swift 0x00000000007861c5 main + 2837 Stack dump: 0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28268-swift-type-transform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28268-swift-type-transform-b6bd0e.o 1. While type-checking declaration 0x648dd80 at validation-test/compiler_crashers/28268-swift-type-transform.swift:10:5 2. While type-checking 'a' at validation-test/compiler_crashers/28268-swift-type-transform.swift:10:6 3. While resolving type A.e at [validation-test/compiler_crashers/28268-swift-type-transform.swift:11:13 - line:11:15] RangeText="A.e" <unknown>:0: error: unable to execute command: Aborted <unknown>:0: error: compile command failed due to signal (use -v to see invocation) ```
1 parent 2b12cc8 commit dace490

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See http://swift.org/LICENSE.txt for license information
6+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// RUN: not --crash %target-swift-frontend %s -parse
9+
// REQUIRES: asserts
10+
var:{protocol a{struct A:a
11+
typealias e=A.e

0 commit comments

Comments
 (0)