Skip to content

Ensure that SimpleDateFormat::fUsePlainSpaces is always initialized #40

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
merged 1 commit into from
Aug 1, 2024

Conversation

jmschonfeld
Copy link
Contributor

We had a bug in our implementation that would leave SimpleDateFormat::fUsePlainSpaces uninitialized on non-Darwin. This would mean that when we read the uninitialized memory, the nondeterministic contents would determine whether date format patterns used U+0020 or U+202F leading to sporadic test failures that didn't account for both variants. This ensures the variable is always initialized to false so that we always get U+202F.

This should allow us to remove hacks like https://github.com/apple/swift-foundation/blob/8a44479120e4ae0ac8cdbf801943daa0d1e874ad/Sources/TestSupport/TestSupport.swift#L246-L274 entirely since we now use a deterministic separator.

iCharlesHu added a commit to iCharlesHu/swift-foundation-icu that referenced this pull request Aug 1, 2024
@jmschonfeld jmschonfeld force-pushed the date-format-uninitialized branch from bf243d9 to b05b241 Compare August 1, 2024 01:21
@jmschonfeld
Copy link
Contributor Author

Linux and Windows toolchain tests pass with this change

@jmschonfeld jmschonfeld merged commit 977bdc9 into swiftlang:main Aug 1, 2024
@jmschonfeld jmschonfeld deleted the date-format-uninitialized branch August 1, 2024 05:03
jmschonfeld added a commit to jmschonfeld/swift-foundation-icu that referenced this pull request Aug 1, 2024
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