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-1989] Crash at runtime when a class contains a struct having no property #44598

Closed
swift-ci opened this issue Jul 5, 2016 · 6 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 run-time crash Bug → crash: Swift code crashed during execution

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jul 5, 2016

Previous ID SR-1989
Radar None
Original Reporter hbr (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

XCode 7.3
Swift 2.2
OSX 10.11.5

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, RunTimeCrash
Assignee hbr (JIRA)
Priority Medium

md5: ed0695e8b1c6dbc373767f6e3c77cd48

duplicates:

  • SR-1055 Crash in libobjc when class's first stored property's type is not Objective-C compatible

Issue Description:

Description

I get a crash (bad memory access) at runtime when allocating a class containing a struct having no property.
Crash reproduced by several colleagues having the same config as mine.
Playgrounds are not affected by the crash.

Test case

Paste this in the main.swift of an XCode 7.3 OSX Command Line Tool project :

struct Foo  {
    // let value = 42           // Uncommenting this line removes the crash
    
    func printMessage() {
        print("foo")
    }
}

class Bar {
    let foo = Foo()
}

let foo = Foo()
foo.printMessage()              // OK

let bar = Bar()                 // EXC_BAD_ACCESS
bar.foo.printMessage()

// oddly enough, it does not crash in Playgrounds...
@swift-ci
Copy link
Collaborator Author

swift-ci commented Jul 5, 2016

Comment by Zenny Chen (JIRA)

It doesn't crash in a Cocoa Application.
macOS 10.11.5, Xcode 7.3.1, Swift 2.2

@belkadan
Copy link
Contributor

belkadan commented Jul 5, 2016

@slavapestov, does this sound familiar?

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jul 5, 2016

Comment by Hervé Bérenger (JIRA)

zenny_chen (JIRA User), This is odd : on my side I've just reproduced the crash in a fresh OSX Cocoa application...
(see attached pic)
Still on XCode 7.3 / Swift 2.2 / OSX 10.11.5 :

@slavapestov
Copy link
Member

I seem to recall @jckarter fixing this in 2.2.1 – Joe?

@jckarter
Copy link
Member

jckarter commented Jul 5, 2016

Should be fixed in 2.2.1, yeah.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jul 6, 2016

Comment by Hervé Bérenger (JIRA)

Great, thanks a lot guys - and sorry for the duplicate.

@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 run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

5 participants