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-8963] Inlining a Swift method accessing a C bitfield member may cause a linker error #51468

Closed
swift-ci opened this issue Oct 10, 2018 · 12 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-8963
Radar rdar://problem/45217460
Original Reporter stephan (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

MacOS High Sierra 10.13.6 (17G65), Xcode 10.1 Beta 2 (and earlier versions)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: e9d709455497070eb364751ae5052319

Issue Description:

Steps to reproduce, e.g. in Xcode 10.1 Beta 2:

  • Clone https://github.com/stephan-tolksdorf/STULabel

  • Open STULabel.xcodeproj

  • Select 'STULabel' scheme

  • Set the Build configuration for Test targets to 'Release' (in Product -> Scheme -> Edit scheme...)

  • Uncomment one or more of the @inlinable attributes in the STULabelSwift code marked with the comment "// swift inlining bug", e.g. the attribute on the Paragraph.``isLastParagraph property in the STULabelSwift/STUTextFrame.overlay.swift file

  • Select a simulator and build the tests (via Product -> Build For -> Testing)

  • Observe the linker error(s) similar to the following :
    Undefined symbols for architecture x86_64:

"OBJC_CLASS$_STUTextFrameDrawingOptions", referenced from:

  objc-class-ref in TextFrameImageBoundsTests.o

"$_STUTextFrameParagraph$isLastParagraph$getter", referenced from:

  partial apply forwarder for implicit closure \#31 : @autoclosure () throws -\> Swift.Bool in DynamicFrameworkTests.SwiftWrapperTests.testTextFrameParagraphAndLineProperties() -\> () in SwiftWrapperTests.o

ld: symbol(s) not found for architecture x86_64

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Oct 12, 2018

@swift-ci create

@gottesmm
Copy link
Member

stephan (JIRA User) I am going to try to reproduce this with ToT of your project. I am worried that it may not reproduce (hopefully it does). Just in case, can you give me the hash in the repo I should check out?

@swift-ci
Copy link
Collaborator Author

Comment by Stephan Tolksdorf (JIRA)

If this problem still exists then you should be able to reproduce it with the ToT of STULabel. A few days ago I failed to reproduce the issue with a minimal test case when using the master branch version of Swift.

@swift-ci
Copy link
Collaborator Author

Comment by Stephan Tolksdorf (JIRA)

Thanks for looking into the issue!

@slavapestov
Copy link
Member

I reduced a test case and reproduced it with 4.2. It appears to have been fixed already on master. I'll beef up our regression tests for bitfields.

Also I found an unrelated source compatibility issue while building your project on master. Once I investigate that I'll close out this bug.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Dec 3, 2018

Comment by Stephan Tolksdorf (JIRA)

Thank you, Slava!

@gottesmm
Copy link
Member

gottesmm commented Dec 4, 2018

stephan (JIRA User) @slavapestov If this is exposing source compatibility issues, maybe add this to the source compatibility suite?

@slavapestov
Copy link
Member

#21018

@slavapestov
Copy link
Member

I still need to investigate the other source compat issue – I'll reduce a test case and file a new bug shortly

@swift-ci
Copy link
Collaborator Author

Comment by Stephan Tolksdorf (JIRA)

There seems to a be a new regression issue in the Xcode 10.2 beta that breaks compilation of the STULabel Demo target (latest master branch version) in the Swift 4.2 mode. My workaround for SR-6894 seems to have stopped working. @slavapestov could you maybe take a look?

@slavapestov
Copy link
Member

Do you mind filing a new bug for the new regression so that we don't forget about it? Unless it's the same bitfield accessor linkage issue in which case you should re-open this one. Thanks!

@swift-ci
Copy link
Collaborator Author

Comment by Stephan Tolksdorf (JIRA)

Thanks! I've created SR-9785.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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
Projects
None yet
Development

No branches or pull requests

3 participants