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-5867] Compiler crashes "While running pass #16 SILModuleTransform ""Capture Promotion to Eliminate Escaping Boxes""" #48437

Closed
swift-ci opened this issue Sep 11, 2017 · 2 comments
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

Previous ID SR-5867
Radar https://bugreport.apple.com/web/?problemID=34219354
Original Reporter tncowart (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 9 beta 6++, macOS 10.12.6

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

md5: d6f68b1dd87481cd5479384c61a3b7ba

Issue Description:

Steps to Reproduce:

  1. Add the following to a file (swift_bug.swift):

    class Test { 
        func thing(_ param: inout (() -> Void)?) -> Self { 
            var item: Int = 8 
            param = { [weak self] in self?.intFunc(item) } 
            return self 
        }
        public func intFunc(_ item: Int?) { } 
    }
    
  2. compile with swift swift_bug.swift

Expected Results: a successful build with a "Variable 'item' was never mutated, consider changing to 'let' constant" warning (that's what happens with the swift 3.1 compiler)

Actual Results: The swift compiler Segfaults (see attached log)

The compiler no longer segfaults with any of the following changes:

  • `var item` is changed to `let item`

  • `func thing` returns something besides `Self` (`Int`, for instance)

  • the closure assigned to `param` captures `self` as a strong reference

@belkadan
Copy link
Contributor

   Assertion failed: (N+M <= size() && "Invalid specifier"), function slice, file /Volumes/Data/swift-public/llvm/include/llvm/ADT/ArrayRef.h, line 180.

7  swift                    0x000000010b8b902d swift::SILBuilder::getPartialApplyResultType(swift::SILType, unsigned int, swift::SILModule&, llvm::ArrayRef<swift::Substitution>, swift::ParameterConvention) + 1005
8  swift                    0x000000010b8ee088 swift::PartialApplyInst::create(swift::SILDebugLocation, swift::SILValue, llvm::ArrayRef<swift::SILValue>, llvm::ArrayRef<swift::Substitution>, swift::ParameterConvention, swift::SILFunction&, swift::SILOpenedArchetypesState&, swift::GenericSpecializationInformation const*) + 104
9  swift                    0x000000010b73d6e6 swift::SILBuilder::createPartialApply(swift::SILLocation, swift::SILValue, llvm::ArrayRef<swift::Substitution>, llvm::ArrayRef<swift::SILValue>, swift::ParameterConvention, swift::GenericSpecializationInformation const*) + 198

1.  While running pass #&#8203;16 SILModuleTransform "Capture Promotion to Eliminate Escaping Boxes".

A good old out-of-bounds error. shajrawi (JIRA User), who'd be good to look at this?

@belkadan
Copy link
Contributor

Ah, it looks like @eeckstein already got to it.

master: #11801
4.0: #11807

May or may not make Xcode 9 GM.

@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

3 participants