Skip to content

Runtime: Fix breakage when generic subclasses directly inherit NSObject (3.0) #4880

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Sep 20, 2016

  • Description: Pretty bad miscompile when two things happen: a) the user defines a generic class inheriting directly from NSObject b) the class is final, or has a final stored property. In this case we use a more direct access pattern, but it does not match up with what the runtime does, leading to a crash.
  • Risk: Low, but I need to see if this impacts remote mirrors in any way before we merge it.
  • Reviewed by: @jckarter
  • Tested: New execution test added
  • Radar: rdar://problem/28207605, JIRA: https://bugs.swift.org/browse/SR-2586

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

This change breaks AnyHashable implementation details. I'm going to go with a simpler fix.

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - d68d9d235b6aae90669fb3f82d97b76ffbbc3d32
Test requested by - @slavapestov

@tkremenek
Copy link
Member

Fails on macOS:

/Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.0-branch/swift/test/Interpreter/generic_objc_subclass.swift:249:11: error: expected string not found in input
23:08:23 // CHECK: 30
23:08:23           ^
23:08:23 <stdin>:29:1: note: scanning from here
23:08:23 3689137777568666719
23:08:23 ^
23:08:23 
23:08:23 --

@tkremenek tkremenek assigned slavapestov and unassigned tkremenek Sep 20, 2016
Remove special-casing that makes NSObject fragile since
this messes up layout. The optimization probably has little
practical benefit anyway.

Fixes <https://bugs.swift.org/browse/SR-2586>.
@slavapestov slavapestov force-pushed the fix-generic-subclass-nsobject-3.0 branch from d68d9d2 to 8d3526e Compare September 22, 2016 04:08
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

@jckarter Can you bless this one with your mighty rubber stamp?

@jckarter
Copy link
Contributor

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants