Skip to content

Compiler crash when emitting SIL #64559

Open
@jpsim

Description

@jpsim

Description

The Swift compiler crashes when emitting SIL for the following Swift code:

// Logger.swift
final class StdoutOutputStream: TextOutputStream {
    func write(_ string: String) {}
}

final class DefaultLogger {
    private var stdout: TextOutputStream

    init(stdout: TextOutputStream = StdoutOutputStream()) {
        self.stdout = stdout
    }

    func logDebug(_ message: String) {
        print(message, to: &self.stdout)
    }
}

Steps to reproduce

swiftc Logger.swift

Expected behavior

Should compile successfully.

Environment

  • Swift compiler version info: swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51), Target: arm64-apple-macosx13.0
  • Xcode version info: Xcode 14.2, Build version 14C18
  • Deployment target: macOS 13.2.1

Metadata

Metadata

Assignees

Labels

SILGenArea → compiler: The SIL generation stagebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwaredefault argumentsFeature: default arguments for value parametersexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesfunction parametersFeature → declarations: function parametersgenericsFeature: generic declarations and typesimplicit existential openingFeature → existentials: implicit opening of existentials when passed to parameters of generic typeinoutFeature → types: `inout` typesswift 5.9typesFeature: typesvariadic parametersFeature → declarations → function parameters: Variadic function parameters

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions