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-11242] segfault in Xcode 11 beta 5 if property wrapper says initialValue #53643

Closed
mattneub opened this issue Jul 31, 2019 · 3 comments
Closed
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 property wrappers Feature: property wrappers

Comments

@mattneub
Copy link

Previous ID SR-11242
Radar None
Original Reporter @mattneub
Type Bug
Status Closed
Resolution Duplicate

Attachment: Download

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

md5: bc684ade1d6192538289ffc99f0d8aeb

duplicates:

  • SR-11063 propertyWrapper type checking compiler crash

Issue Description:

In Xcode 11 beta 5, a property wrapper that uses `initialValue` causes a segfault 11.

I found this message in the build log, inside the segfault information:

warning: property wrapper's `init(initialValue:)` should be renamed to 'init(wrappedValue:)'; 
use of 'init(initialValue:)' is deprecated

Yup, making that change fixed the problem. But the warning never made it to the Issue navigator, because we segfaulted instead.

(Oh, forgot to mention, the syntax checker crashed too, just opening the file.)

@theblixguy
Copy link
Collaborator

Do you have an example? I can't seem to reproduce it.

@mattneub
Copy link
Author

@theblixguy Sure, enclosed. Reliably segfaults for me. Version 11.0 beta 5 (11M382q). Mojave 10.14.6. Thanks!

@theblixguy
Copy link
Collaborator

Thanks, here's a reduced example:

@propertyWrapper struct Clamped<T: Comparable> {
  private var _i: T
  private let min: T
  private let max: T

  init(initialValue: T, min: T, max: T) {
    self._i = initialValue
    self.min = min
    self.max = max
  }

  let projectedValue = "yoho"

  var wrappedValue : T {
    get { self._i }
    set { self._i = max(min(newValue,self.max),self.min) }
  }
}

class Foo {
  @Clamped(min: -7, max: 7) var clamped : Int = 0
}

It doesn't crash for me on master though, but does crash on Xcode 11 Beta 5 as you said.

@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 property wrappers Feature: property wrappers
Projects
None yet
Development

No branches or pull requests

3 participants