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-2367] Swift 3 (Xcode 8 beta 6) type-checking crash #44974

Closed
keith opened this issue Aug 16, 2016 · 4 comments
Closed

[SR-2367] Swift 3 (Xcode 8 beta 6) type-checking crash #44974

keith opened this issue Aug 16, 2016 · 4 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 type checker Area → compiler: Semantic analysis

Comments

@keith
Copy link
Collaborator

keith commented Aug 16, 2016

Previous ID SR-2367
Radar rdar://problem/27686847
Original Reporter @keith
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee @rudkx
Priority Medium

md5: 7ab29358f0fff6c5a7881d8aca8ba945

duplicates:

  • SR-2288 8/4 Snapshot Assertion Failure

Issue Description:

With Xcode 8 beta 6 and this code:

protocol Convertible {}
struct User: Convertible {}
struct Friend: Convertible {}

func stuff(users: [User], friends: [Friend]) -> [Convertible] {
    // Crashes
    return users + friends

    // Works fine
    // return users as [Convertible] + friends as [Convertible]
    
    // Also works fine (required before beta 6)
    // return users.map { $0 as Convertible } + friends.map { $0 as Convertible }
}

The first return statement crashes with this log:

0  swift                    0x0000000109d7299d PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x0000000109d723e6 SignalHandler(int) + 470
2  libsystem_platform.dylib 0x00007fff94acd52a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff58ae3750 _sigtramp + 3288425024
4  swift                    0x0000000107961fed (anonymous namespace)::FailureDiagnosis::typeCheckArgumentChildIndependently(swift::Expr*, swift::Type, (anonymous namespace)::CalleeCandidateInfo const&, swift::OptionSet<TCCFlags, unsigned int>) + 2285
5  swift                    0x0000000107965375 (anonymous namespace)::FailureDiagnosis::visitApplyExpr(swift::ApplyExpr*) + 837
6  swift                    0x0000000107948d95 swift::ASTVisitor<(anonymous namespace)::FailureDiagnosis, bool, void, void, void, void, void>::visit(swift::Expr*) + 357
7  swift                    0x00000001079435a2 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 82
8  swift                    0x000000010796cfbf swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4367
9  swift                    0x00000001079e6555 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 1157
10 swift                    0x00000001079e8ca0 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 736
11 swift                    0x0000000107a6aac2 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 6114
12 swift                    0x0000000107a69426 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 326
13 swift                    0x0000000107a684bd swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 365
14 swift                    0x0000000107a6cbfc swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 188
15 swift                    0x0000000107a21caa swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 6714
16 swift                    0x00000001076d8cbf swift::CompilerInstance::performSema() + 5199
17 swift                    0x000000010718606d performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2765
18 swift                    0x00000001071832c5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17029
19 swift                    0x000000010714088d main + 8685
20 libdyld.dylib            0x00007fff904cc5ad start + 1
Stack dump:
0.      Program arguments: /Applications/Xcode-beta6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret foo.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode-beta6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics -module-name foo
1.      While type-checking 'stuff' at foo.swift:5:1
2.      While type-checking expression at [foo.swift:7:12 - line:7:20] RangeText="users + f"
zsh: segmentation fault  swift foo.swift
@belkadan
Copy link
Contributor

Another "didn't see this OVE in a containing OpenExistentialExpr?" for Mark.

@rudkx
Copy link
Member

rudkx commented Aug 17, 2016

I believe this is not expected to work without the casts to [Convertible] since '+' takes two arrays of the same type (not two arrays that we can convert to the same type).

As a result I think this is just another instance of crashing when we attempt to emit a diagnostic in the presence of a collection conversion.

@rudkx
Copy link
Member

rudkx commented Aug 17, 2016

Please verify against a build once https://bugs.swift.org/browse/SR-2288 is resolved.

@keith
Copy link
Collaborator Author

keith commented Aug 18, 2016

Can verify this is fixed by the linked issue and #4329

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants