Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-4295] Crash-on-invalid: failed to find PA's conformance to known protocol #46878

Closed
dabrahams opened this issue Mar 20, 2017 · 14 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-4295
Radar rdar://problem/31372308
Original Reporter @dabrahams
Type Bug
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @DougGregor
Priority Medium

md5: 21adb8e2be73de6260a6fefea31ee894

Issue Description:

NOTE: Probably reproduces with a github/master build

$ git fetch https://github.com/dabrahams/swift refs/bugs/SR-failed-to-find-PAs-conformance-to-known-protocol:BUG && git checkout BUG

Now build the Prototypes/AU3.swift.gyb test

rm -rf /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp && mkdir -p /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp && /Users/Shared/dabrahams/s/swift/utils/gyb -DWORD_BITS=64 /Users/Shared/dabrahams/s/swift/test/Prototypes/AU3.swift.gyb -o /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift && /Users/Shared/dabrahams/s/swift/utils/line-directive /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift -- xcrun --toolchain default --sdk /Applications/Xcode-8W109m.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/./bin/swiftc -target x86_64-apple-macosx10.9  -module-cache-path '/var/folders/k9/nzq6k4f57xb5vw8wrgk_7cvh0000gn/T/swift-testsuite-clang-module-cacheVwD5Zd' -F /Applications/Xcode-8W109m.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/../../../Developer/Library/Frameworks -Xlinker -rpath -Xlinker /Applications/Xcode-8W109m.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/../../../Developer/Library/Frameworks  -swift-version 3  /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift -o /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/a.out -Onone && /Users/Shared/dabrahams/s/swift/utils/line-directive /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift --  /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/a.out
/Users/Shared/dabrahams/s/swift/test/Prototypes/AU3.swift.gyb:185:12: error: same-type constraint type 'AnyUnicodeView_' does not conform to required protocol 'BidirectionalCollection'
where Base == AnyUnicodeView_,
           ^
Assertion failed: (conformance && "failed to find PA's conformance to known protocol"), function operator(), file /Users/Shared/dabrahams/s/swift/lib/AST/GenericSignatureBuilder.cpp, line 1524.
0  swift                    0x0000000107301c18 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001073022c6 SignalHandler(int) + 454
2  libsystem_platform.dylib 0x00007fffbd848b3a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1115387104
4  libsystem_c.dylib        0x00007fffbd6cd420 abort + 129
5  libsystem_c.dylib        0x00007fffbd694893 basename_r + 0
6  swift                    0x0000000104f92cb6 swift::ProtocolConformanceRef llvm::function_ref<swift::ProtocolConformanceRef (swift::ProtocolDecl*)>::callback_fn<swift::GenericSignatureBuilder::PotentialArchetype::updateNestedTypeForConformance(llvm::PointerUnion<swift::AssociatedTypeDecl*, swift::TypeAliasDecl*>, swift::GenericSignatureBuilder::PotentialArchetype::NestedTypeUpdate)::$_1>(long, swift::ProtocolDecl*) + 470
7  swift                    0x0000000104f84286 concretizeNestedTypeFromConcreteParent(swift::GenericSignatureBuilder::PotentialArchetype*, swift::GenericSignatureBuilder::RequirementSource const*, swift::GenericSignatureBuilder::PotentialArchetype*, swift::GenericSignatureBuilder&, llvm::function_ref<swift::ProtocolConformanceRef (swift::ProtocolDecl*)>) + 294
8  swift                    0x0000000104f835e5 swift::GenericSignatureBuilder::PotentialArchetype::updateNestedTypeForConformance(llvm::PointerUnion<swift::AssociatedTypeDecl*, swift::TypeAliasDecl*>, swift::GenericSignatureBuilder::PotentialArchetype::NestedTypeUpdate) + 2517
9  swift                    0x0000000104f81ec0 swift::GenericSignatureBuilder::PotentialArchetype::getNestedArchetypeAnchor(swift::Identifier, swift::GenericSignatureBuilder&) + 704
10 swift                    0x0000000104f819fa swift::GenericSignatureBuilder::PotentialArchetype::getArchetypeAnchor(swift::GenericSignatureBuilder&) + 266
11 swift                    0x0000000104f8aada swift::GenericSignatureBuilder::finalize(swift::SourceLoc, llvm::ArrayRef<swift::GenericTypeParamType*>, bool) + 1130
12 swift                    0x0000000104e54ac5 swift::TypeChecker::checkGenericEnvironment(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, bool, llvm::function_ref<void (swift::GenericSignatureBuilder&)>) + 645
13 swift                    0x0000000104e2e43a checkExtensionGenericParams(swift::TypeChecker&, swift::ExtensionDecl*, swift::Type, swift::GenericParamList*) + 170
14 swift                    0x0000000104e2322b swift::TypeChecker::validateExtension(swift::ExtensionDecl*) + 203
15 swift                    0x0000000104e2390c swift::TypeChecker::computeDefaultAccessibility(swift::ExtensionDecl*) + 60
16 swift                    0x0000000104e2463b swift::TypeChecker::computeAccessibility(swift::ValueDecl*) + 923
17 swift                    0x0000000104e24825 swift::TypeChecker::validateAccessibility(swift::ValueDecl*) + 69
18 swift                    0x0000000104e29a45 swift::TypeChecker::validateDecl(swift::ValueDecl*) + 229
19 swift                    0x0000000104e28de9 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2649
20 swift                    0x0000000104e379eb (anonymous namespace)::DeclChecker::visitProtocolDecl(swift::ProtocolDecl*) + 1131
21 swift                    0x0000000104e28567 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 471
22 swift                    0x0000000104e28384 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 100
23 swift                    0x0000000104ea3274 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1524
24 swift                    0x0000000104aa1970 swift::CompilerInstance::performSema() + 3616
25 swift                    0x000000010400f29c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4380
26 swift                    0x0000000103fcc9f0 main + 3312
27 libdyld.dylib            0x00007fffbd639235 start + 1
Stack dump:
0.  Program arguments: /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file /Users/Shared/dabrahams/s/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-macosx-x86_64/test-macosx-x86_64/Prototypes/Output/AU3.swift.gyb.tmp/out.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode-8W109m.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -F /Applications/Xcode-8W109m.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/../../../Developer/Library/Frameworks -module-cache-path /var/folders/k9/nzq6k4f57xb5vw8wrgk_7cvh0000gn/T/swift-testsuite-clang-module-cacheVwD5Zd -swift-version 3 -Onone -module-name a -o /var/folders/k9/nzq6k4f57xb5vw8wrgk_7cvh0000gn/T/out-55cc6e.o 
1.  While type-checking 'BidirectionalCollectionWrapper' at /Users/Shared/dabrahams/s/swift/test/Prototypes/AU3.swift.gyb:34:8
2.  While type-checking '_wrap' at /Users/Shared/dabrahams/s/swift/test/Prototypes/AU3.swift.gyb:38:3
3.  While validating '_wrap' at /Users/Shared/dabrahams/s/swift/test/Prototypes/AU3.swift.gyb:187:3
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)

Other hashes

clang                              f4b8df66a5 Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
cmark                              d875488 Merge pull request #&#8203;4 from llvm-beanz/generate-cmark-exports
compiler-rt                        572336a0b Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
llbuild                            c8a84b3 Merge pull request #&#8203;130 from hughbe/mkdir-windows
lldb                               9ca9758f9 Merge pull request #&#8203;149 from bitjammer/swift-typealias-equal-sourceloc
llvm                               e69035ecc18 Merge remote-tracking branch 'origin/swift-4.0-branch' into stable
ninja                              0b0374e Merge pull request #&#8203;1255 from tchajed/bind-localhost
swift                              318050c9fd5 Add a small note
swift-corelibs-foundation          ba5134d Fix for [SR-1250] NSJSONSerialization emits non-floating-point numbers as Double (#914)
swift-corelibs-libdispatch         d137aa4 Makes the DispatchIO initializer that accepts a path failable, reflecting the fact that a relative or non-existent path is invalid.
swift-corelibs-xctest              50cc074 XCTestAssertNoThrow (#184)
swift-integration-tests            8ae3586 Merge pull request #&#8203;18 from apple/disable-lldb-test
swift-xcode-playground-support     9e980f2 Temporary disable test to get the incremental bot blue again
swiftpm                            eb8ec5da Merge pull request #&#8203;1028 from aciidb0mb3r/version-fix
@belkadan
Copy link
Contributor

cc @huonw

@huonw
Copy link
Mannequin

huonw mannequin commented Mar 21, 2017

Hm, something strange has happened here: GitHub can't show me anything other than the front page of that ref (clicking into any of the directories/files gives a 404), doesn't list it in any of the branch/tag drop downs, and I can't work out how to check it out locally (it doesn't seem to appear under `git branch -a` nor `git tag --list`).

@belkadan
Copy link
Contributor

GitHub doesn't like slashes in branch names. Workaround: open up the tree for the most recent commit instead.

@belkadan
Copy link
Contributor

I meant to file a bug with GitHub about this but haven't yet.

@belkadan
Copy link
Contributor

Actually I take that back. Both branches and tags with slashes work fine for me in my own repo. I'm not sure what Dave did.

@dabrahams
Copy link
Collaborator Author

@belkadan, @huonw I didn't do anything special, and the link works for me. I tested it before filing the bug and just checked it again. Using Safari?

@huonw
Copy link
Mannequin

huonw mannequin commented Mar 21, 2017

Clicking the link works (in Safari), but doing almost anything with it (including checking it out locally) other than listing the commits does not.

@dabrahams
Copy link
Collaborator Author

   Skree:~ dave$ cd /tmp
Skree:tmp dave$ rm -rf q
Skree:tmp dave$ mkdir q
Skree:tmp dave$ cd q
Skree:q dave$ git init
Initialized empty Git repository in /private/tmp/q/.git/
Skree:q dave$ git remote add dabrahams https://github.com/dabrahams/swift.git
Skree:q dave$ git fetch dabrahams refs/bugs/SR-failed-to-find-PAs-conformance-to-known-protocol
remote: Counting objects: 515793, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 515793 (delta 4), reused 1 (delta 1), pack-reused 515787
Receiving objects: 100% (515793/515793), 166.32 MiB | 1.24 MiB/s, done.
Resolving deltas: 100% (424098/424098), done.
From https://github.com/dabrahams/swift
 * branch            refs/bugs/SR-failed-to-find-PAs-conformance-to-known-protocol -> FETCH_HEAD
Skree:q dave$ git checkout FETCH_HEAD
Checking out files: 100% (12533/12533), done.
Note: checking out '18d7d64'.

@dabrahams
Copy link
Collaborator Author

@huonw Bug description updated with simpler instructions

@dabrahams
Copy link
Collaborator Author

@belkadan should this be added to the sync system?

@dabrahams
Copy link
Collaborator Author

@swift-ci create

@dabrahams
Copy link
Collaborator Author

A simpler repro is attached; verified failure with github/master 8ecc3e3 UnicodeDecoders.swift

@huonw
Copy link
Mannequin

huonw mannequin commented May 3, 2017

Same crash from similar code:

internal protocol _UTFEncoding {
    associatedtype EncodedScalar where EncodedScalar == Int
}

public protocol _UnicodeEncoding {
    associatedtype EncodedScalar : BidirectionalCollection
}

public protocol _UnicodeEncoding_ {
    associatedtype ForwardParser: _UnicodeEncoding
}

public protocol UnicodeEncoding: _UnicodeEncoding_ where ForwardParser == Self {}

public protocol _UTFParser {
    associatedtype Encoding: UnicodeEncoding, _UTFEncoding
}

@DougGregor
Copy link
Member

89bed63

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

4 participants