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-8179] Assertion failure in GSB: (hasVal) when validating and type-checking method #50711

Closed
troughton opened this issue Jul 5, 2018 · 6 comments
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

@troughton
Copy link
Contributor

Previous ID SR-8179
Radar rdar://problem/41851224
Original Reporter @troughton
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: a8fa5f26885b62168e0f2baa8e1dfd84

Issue Description:

Using the latest Swift toolchain from swift.org (master 2018-07-04), compilation of the attached package (with `swift build`) fails when the following method is included:

**public** **func** optionalToArray\<U\>() -\> SignalChannel\<InputValue, Input, \[U\], Signal\<\[U\]\>\> **where** OutputValue == Optional\<U\> {

    **return** next { $0.optionalToArray() }

}

This compiles with the version of Swift included in Xcode 10 beta 3.

Full error log:

swift build
Compile Swift Module 'CwlSignal' (4 sources)
Assertion failed: (hasVal), function operator*, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/include/llvm/ADT/Optional.h, line 145.
0  swift                    0x00000001122e9d28 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001122e8f67 llvm::sys::RunSignalHandlers() + 39
2  swift                    0x00000001122ea3a2 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff5cdd3d3a _sigtramp + 26
4  libsystem_platform.dylib 0x00000000000039e0 _sigtramp + 2736979136
5  libsystem_c.dylib        0x00007fff5cc95151 abort + 127
6  libsystem_c.dylib        0x00007fff5cc5d912 __assert_rtn + 320
7  swift                    0x000000010fd238b4 _ZN5swift23GenericSignatureBuilder19checkConstraintListINS_4TypeES2_EENS0_10ConstraintIT_EENS_12ArrayRefViewIS2_PNS_20GenericTypeParamTypeEL_ZNS_16staticCastHelperIS7_EEPS4_RKS2_ELb1EEERNSt3__16vectorIS5_NSE_9allocatorIS5_EEEEN4llvm12function_refIFbRKS5_EEENSL_IFNS0_18ConstraintRelationESN_EEENSK_8OptionalINS_4DiagIJjS2_T0_SV_EEEEENSU_IJS2_SV_EEENSU_IJjS2_SV_EEENSL_IFSV_RKS4_EEEb + 1524
8  swift                    0x000000010fd1d890 swift::GenericSignatureBuilder::checkSuperclassConstraints(swift::ArrayRefView<swift::Type, swift::GenericTypeParamType*, swift::GenericTypeParamType* swift::staticCastHelper<swift::GenericTypeParamType>(swift::Type const&), true>, swift::GenericSignatureBuilder::EquivalenceClass*) + 352
9  swift                    0x000000010fd1bee3 swift::GenericSignatureBuilder::finalize(swift::SourceLoc, swift::ArrayRefView<swift::Type, swift::GenericTypeParamType*, swift::GenericTypeParamType* swift::staticCastHelper<swift::GenericTypeParamType>(swift::Type const&), true>, bool) + 707
10 swift                    0x000000010fd24d5b swift::GenericSignatureBuilder::computeGenericSignature(swift::SourceLoc, bool, bool) && + 59
11 swift                    0x000000010f9c56e5 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 133
12 swift                    0x000000010f99fcfa swift::TypeChecker::validateDecl(swift::ValueDecl*) + 7978
13 swift                    0x000000010f9abdb9 (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) + 41
14 swift                    0x000000010f99ae0e (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 190
15 swift                    0x000000010f9ac02b (anonymous namespace)::DeclChecker::visitExtensionDecl(swift::ExtensionDecl*) + 459
16 swift                    0x000000010f99ae3c (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 236
17 swift                    0x000000010f99ad46 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 38
18 swift                    0x000000010fa33298 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1784
19 swift                    0x000000010f666882 swift::CompilerInstance::parseAndCheckTypes(swift::CompilerInstance::ImplicitImports const&) + 834
20 swift                    0x000000010f6660e9 swift::CompilerInstance::performSema() + 473
21 swift                    0x000000010eac4c22 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1426
22 swift                    0x000000010eac3618 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2952
23 swift                    0x000000010ea7d8ae main + 1134
24 libdyld.dylib            0x00007fff5cbd93ed start + 1
25 libdyld.dylib            0x000000000000002a start + 2739039294
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-07-04-a.xctoolchain/usr/bin/swift -frontend -c /Users/Thomas/CwlSignal/Sources/CwlSignal/CwlDispatch.swift -primary-file /Users/Thomas/CwlSignal/Sources/CwlSignal/CwlSignalExtensions_public.swift /Users/Thomas/CwlSignal/Sources/CwlSignal/CwlSignal_public.swift /Users/Thomas/CwlSignal/Sources/CwlSignal/CwlUtils_public.swift -emit-module-path /Users/Thomas/CwlSignal/.build/x86_64-apple-macosx10.10/debug/CwlSignal.build/CwlSignalExtensions_public~partial.swiftmodule -emit-module-doc-path /Users/Thomas/CwlSignal/.build/x86_64-apple-macosx10.10/debug/CwlSignal.build/CwlSignalExtensions_public~partial.swiftdoc -emit-dependencies-path /Users/Thomas/CwlSignal/.build/x86_64-apple-macosx10.10/debug/CwlSignal.build/CwlSignalExtensions_public.d -emit-reference-dependencies-path /Users/Thomas/CwlSignal/.build/x86_64-apple-macosx10.10/debug/CwlSignal.build/CwlSignalExtensions_public.swiftdeps -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/Thomas/CwlSignal/.build/x86_64-apple-macosx10.10/debug -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/Thomas/CwlSignal/.build/x86_64-apple-macosx10.10/debug/ModuleCache -swift-version 4.2 -Onone -D SWIFT_PACKAGE -D DEBUG -color-diagnostics -parse-as-library -module-name CwlSignal -o /Users/Thomas/CwlSignal/.build/x86_64-apple-macosx10.10/debug/CwlSignal.build/CwlSignalExtensions_public.swift.o 
1. While type-checking extension of SignalChannel<InputValue, Input, OutputValue, Output> at /Users/Thomas/CwlSignal/Sources/CwlSignal/CwlSignalExtensions_public.swift:3866:1
2. While type-checking 'optionalToArray()' at /Users/Thomas/CwlSignal/Sources/CwlSignal/CwlSignalExtensions_public.swift:3926:12
3. While validating 'optionalToArray()' at /Users/Thomas/CwlSignal/Sources/CwlSignal/CwlSignalExtensions_public.swift:3926:12
<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)
*error:* terminated(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-07-04-a.xctoolchain/usr/bin/swift-build-tool -f /Users/Thomas/CwlSignal/.build/debug.yaml main output:
@belkadan
Copy link
Contributor

belkadan commented Jul 5, 2018

@swift-ci create

@DougGregor
Copy link
Member

Reproduced locally; I'll take a look.

@DougGregor
Copy link
Member

#18265 fixes the GSB assertion

@DougGregor
Copy link
Member

That's merged to master (c643d1d), but I hit a different issue that affects this project.

@DougGregor
Copy link
Member

#18268 fixes the second issue.

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

@troughton, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@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