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-11048] Swift 5.0.1 Compiler Crash when delegating Collection conformance to another package (Swift 5.0.1 open source releases) #53437

Open
swift-ci opened this issue Jun 30, 2019 · 1 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

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jun 30, 2019

Previous ID SR-11048
Radar rdar://problem/52463698
Original Reporter bwetherfield (JIRA User)
Type Bug

Attachment: Download

Environment

macOS 10.14, swift-5.0.1-RELEASE
Ubuntu 14.0.4 (trusty), swift-5.0.1-RELEASE

.travis.yml:

env:
  global:
    - SWIFT_BRANCH=swift-5.0.1-release
    - SWIFT_VERSION=swift-5.0.1-RELEASE
matrix:
  include:
    - os: linux
      language: generic
      dist: trusty
      sudo: required
      install:
        - sudo apt-get install clang libicu-dev
        - mkdir swift
        - curl https://swift.org/builds/$SWIFT_BRANCH/ubuntu1404/$SWIFT_VERSION/$SWIFT_VERSION-ubuntu14.04.tar.gz -s | tar xz -C swift &> /dev/null
        - export PATH="$(pwd)/swift/$SWIFT_VERSION-ubuntu14.04/usr/bin:$PATH"
      script:
        - swift package update
        - swift build

    - os: osx
      osx_image: xcode10.2
      language: swift
      sudo: required
      install:
        - wget https://swift.org/builds/$SWIFT_BRANCH/xcode/$SWIFT_VERSION/$SWIFT_VERSION-osx.pkg
        - sudo installer -pkg $SWIFT_VERSION-osx.pkg -target /
        - export PATH="/Library/Developer/Toolchains/$SWIFT_VERSION.xctoolchain/usr/bin:$PATH"
      script:
        - swift package update
        - swift build

I do not observe this error when building with the toolchain included with Xcode 10.2.1

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

md5: 6ddc90a558ab63f72bb3621ceb20660f

Issue Description:

Compiler crash when delegating Collection conformance to another package, using a Collection-wrapping protocol in the other package.

Run swift package update and swift build within MinimalExample to reproduce the crash.

MinimalExample contains

import DataStructures

public struct WrappedIntCollection: CollectionWrapping {
    public let base: [Int]
}

where DataStructures is a module in a separate package that contains

public protocol CollectionWrapping: Collection {
    associatedtype Base: Collection
    var base: Base { get }
}

and the Collection conformance requirements of CollectionWrapping are delegated to Base.

macOS stack trace:

Unable to find source-code formatter for language: bash. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yamlAssertion failed: (F->isAvailableExternally() && "external declaration of internal SILFunction not allowed"), function visitSILFunction, file /Users/buildnode/jenkins/workspace/oss-swift-5.0-package-osx/swift/lib/SIL/SILVerifier.cpp, line 4827.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-5.0.1-RELEASE.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/travis/build/bwetherfield/MinimalExample/Sources/MinimalExample/MinimalExample.swift -emit-module-path /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug/MinimalExample.build/MinimalExample~partial.swiftmodule -emit-module-doc-path /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug/MinimalExample.build/MinimalExample~partial.swiftdoc -emit-dependencies-path /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug/MinimalExample.build/MinimalExample.d -emit-reference-dependencies-path /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug/MinimalExample.build/MinimalExample.swiftdeps -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-10.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug -F /Applications/Xcode-10.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -color-diagnostics -enable-anonymous-context-mangled-names -parse-as-library -module-name MinimalExample -o /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug/MinimalExample.build/MinimalExample.swift.o -index-store-path /Users/travis/build/bwetherfield/MinimalExample/.build/x86_64-apple-macosx/debug/index/store -index-system-modules 
1.  While verifying SIL function "@$s14DataStructures18CollectionWrappingPAAEy4Base_7ElementQZAD_5IndexQZcir".
 for read for subscript(_:) (in module 'DataStructures')
0  swift                    0x0000000110535f95 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x0000000110535235 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x0000000110536582 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff61df0b5d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000000001 _sigtramp + 2652959937
5  libsystem_c.dylib        0x00007fff61cb06a6 abort + 127
6  libsystem_c.dylib        0x00007fff61c7920d basename_r + 0
7  swift                    0x000000010d7b0e57 swift::SILFunction::verify(bool) const + 375
8  swift                    0x000000010d7b59f3 swift::SILModule::verify() const + 211
9  swift                    0x000000010d1df5d1 swift::Lowering::SILGenModule::~SILGenModule() + 33
10 swift                    0x000000010d1eb604 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1428
11 swift                    0x000000010d1eb709 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&) + 41
12 swift                    0x000000010c975268 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 7960
13 swift                    0x000000010c9722e8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3016
14 swift                    0x000000010c9243c2 main + 690
15 libdyld.dylib            0x00007fff61c0b3d5 start + 1
16 libdyld.dylib            0x000000000000002b start + 2654948439
<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)

ubuntu 14.04 stack trace:

Unable to find source-code formatter for language: bash. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yamlswift: /home/buildnode/jenkins/workspace/oss-swift-5.0-package-linux-ubuntu-14_04/swift/lib/SIL/SILVerifier.cpp:4827: void (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction *): Assertion `F->isAvailableExternally() && "external declaration of internal SILFunction not allowed"' failed.
Stack dump:
0.  Program arguments: /home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift -frontend -c -primary-file /home/travis/build/bwetherfield/MinimalExample/Sources/MinimalExample/MinimalExample.swift -emit-module-path /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug/MinimalExample.build/MinimalExample~partial.swiftmodule -emit-module-doc-path /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug/MinimalExample.build/MinimalExample~partial.swiftdoc -emit-dependencies-path /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug/MinimalExample.build/MinimalExample.d -emit-reference-dependencies-path /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug/MinimalExample.build/MinimalExample.swiftdeps -target x86_64-unknown-linux -disable-objc-interop -sdk / -I /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug -enable-testing -g -module-cache-path /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -color-diagnostics -enable-anonymous-context-mangled-names -parse-as-library -module-name MinimalExample -o /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug/MinimalExample.build/MinimalExample.swift.o -index-store-path /home/travis/build/bwetherfield/MinimalExample/.build/x86_64-unknown-linux/debug/index/store -index-system-modules 
1.  While verifying SIL function "@$s14DataStructures18CollectionWrappingPAAEy4Base_7ElementQZAD_5IndexQZcir".
 for read for subscript(_:) (in module 'DataStructures')
#&#8203;0 0x0000000004293a44 PrintStackTraceSignalHandler(void*) (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x4293a44)
#&#8203;1 0x0000000004291ba0 llvm::sys::RunSignalHandlers() (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x4291ba0)
#&#8203;2 0x0000000004293da8 SignalHandler(int) (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x4293da8)
#&#8203;3 0x00007f7a1a18e330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#&#8203;4 0x00007f7a18970c37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37)
#&#8203;5 0x00007f7a18974028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028)
#&#8203;6 0x00007f7a18969bf6 (/lib/x86_64-linux-gnu/libc.so.6+0x2fbf6)
#&#8203;7 0x00007f7a18969ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#&#8203;8 0x00000000012fc522 swift::SILFunction::verify(bool) const (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x12fc522)
#&#8203;9 0x0000000001301d43 swift::SILModule::verify() const (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x1301d43)
#&#8203;10 0x0000000000d8ae8b swift::Lowering::SILGenModule::~SILGenModule() (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0xd8ae8b)
#&#8203;11 0x0000000000d97160 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0xd97160)
#&#8203;12 0x0000000000d9729a swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&) (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0xd9729a)
5b4)
#&#8203;14 0x00000000004dc917 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x4dc917)
#&#8203;15 0x000000000048dd93 main (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x48dd93)
#&#8203;16 0x00007f7a1895bf45 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f45)
#&#8203;17 0x000000000048bfe8 _start (/home/travis/build/bwetherfield/MinimalExample/swift/swift-5.0.1-RELEASE-ubuntu14.04/usr/bin/swift+0x48bfe8)
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
@belkadan
Copy link
Contributor

belkadan commented Jul 1, 2019

@swift-ci create

@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
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

3 participants