Skip to content

Several compilation warnings resolved #1106

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 3 commits into from
Jul 10, 2017
Merged

Conversation

bubski
Copy link
Contributor

@bubski bubski commented Jul 10, 2017

Several compilation warnings resolved

IndexPath(indexes: [Int.max >> 8, 2, Int.max >> 36]).hashValue // this should not cause an overflow crash

// this should not cause an overflow crash
let hash: Int? = IndexPath(indexes: [Int.max >> 8, 2, Int.max >> 36]).hashValue
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this reasonable? Or is guaranteed that compiler will not optimize out the below to a no-op?

_ = IndexPath(indexes: [Int.max >> 8, 2, Int.max >> 36]).hashValue

Copy link
Contributor

Choose a reason for hiding this comment

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

eh the assert below validates the non-crash case; and it is a test of an overflow so I think it should be fine as you have it

Copy link
Contributor

@phausler phausler left a comment

Choose a reason for hiding this comment

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

looks good to me, I have the same length removal in another pr but I will deal with that conflict when it comes to be merged

IndexPath(indexes: [Int.max >> 8, 2, Int.max >> 36]).hashValue // this should not cause an overflow crash

// this should not cause an overflow crash
let hash: Int? = IndexPath(indexes: [Int.max >> 8, 2, Int.max >> 36]).hashValue
Copy link
Contributor

Choose a reason for hiding this comment

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

eh the assert below validates the non-crash case; and it is a test of an overflow so I think it should be fine as you have it

@phausler
Copy link
Contributor

@swift-ci please test and merge

@swift-ci swift-ci merged commit caacb0e into swiftlang:master Jul 10, 2017
ianpartridge added a commit to ianpartridge/swift that referenced this pull request Jul 11, 2017
This was removed in `swift-corelibs-foundation` in swiftlang/swift-corelibs-foundation#1106

Make the same change to the overlay version, to keep them in sync.
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