Skip to content

[SwiftCore]: Don't always clobber memory #81010

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

Merged

Conversation

etcwilde
Copy link
Member

The new build system set SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS to 0. Unfortunately, the check in the Swift runtime used #ifdef, so even though it was turned off, it was actually enabled in some cases.

Fixing the issue in the build system as well as switching the check to verify that value of SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS is taken into account in the sources. C/C++ implicitly defines macro values to 1 when set without a value and 0 when it is not set.

Also making the hex a bit more recognizable and grep'able by including it as a comment.

Fixes: rdar://149210738

@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde etcwilde force-pushed the ewilde/runtime-fix-clobbered-memories branch from 3d4eaf7 to 41fdd42 Compare April 22, 2025 23:48
The new build system set `SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS` to 0.
Unfortunately, the check in the Swift runtime used `#ifdef`, so even
though it was turned off, it was actually enabled in some cases.

Fixing the issue in the build system as well as switching the check to
verify that value of `SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS` is taken into
account in the sources. C/C++ implicitly defines macro values to 1 when
set without a value and 0 when it is not set.

Also making the hex a bit more recognizable and grep'able by including
it as a comment.

Fixes: rdar://149210738
@etcwilde etcwilde force-pushed the ewilde/runtime-fix-clobbered-memories branch from 41fdd42 to 6f39a52 Compare April 22, 2025 23:51
Copy link
Contributor

@mikeash mikeash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde
Copy link
Member Author

Known Failure in lang/swift/async/queues/TestSwiftPluginQueues.py from LLDB.

@etcwilde
Copy link
Member Author

@swift-ci please test macOS

@etcwilde
Copy link
Member Author

@swift-ci please test macOS

@etcwilde etcwilde merged commit 9ff70cd into swiftlang:main Apr 24, 2025
5 checks passed
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.

3 participants