Skip to content

[Parse] Avoid 'inout' operator passing in Character.Info testing #932

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 2 commits into from
Oct 13, 2022

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 11, 2022

Passing var value with & operator triggers TSAN "modifying access" detection even though it doesn't actually mutates the value. That results "access race" sanitizer error in multi-thread environments.

Instead of using a tuple table, use 'switch' to test the character info. Also, eliminate unused character info value, and introduce 'IDENT_CONT'

#893
rdar://100906576

Passing `var` value with `&` operator triggers TSAN "modifying access"
detection even though it doesn't actually mutates the value. That
results "access race" sanitizer error in multi-thread environments.

Instead of using a tuple table, use 'switch' to test the character info.
Also, eliminate unused character info value, and introduce 'IDENT_CONT'
@rintaro rintaro requested a review from ahoppen as a code owner October 11, 2022 22:18
@rintaro
Copy link
Member Author

rintaro commented Oct 11, 2022

@swift-ci Please test

@rintaro rintaro requested a review from CodaFi October 11, 2022 22:21
Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

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

It's great to see this table continue to shrink to only the relevant bits.

return self.testRawInfoTable { entry in
!entry.intersection([ .UPPER, .LOWER, .UNDER, ]).isEmpty
}
self.testCharacterInfo(.IDENT_CONT) && !self.isDigit && self != "$"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should burn a bit for identifier starts too.

@rintaro
Copy link
Member Author

rintaro commented Oct 12, 2022

@swift-ci Please test

@rintaro rintaro merged commit 5296d93 into swiftlang:main Oct 13, 2022
@rintaro rintaro deleted the charinfo-rdar100906576 branch October 13, 2022 02:58
jpsim added a commit to realm/SwiftLint that referenced this pull request Oct 13, 2022
jpsim added a commit to realm/SwiftLint that referenced this pull request Oct 13, 2022
jpsim added a commit to realm/SwiftLint that referenced this pull request Oct 13, 2022
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.

2 participants