Skip to content

Changes type avoiding undefined behaviour shifting left negative value in CFTimeZone #2812

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
Jun 21, 2020

Conversation

valeriyvan
Copy link
Contributor

No description provided.

@valeriyvan valeriyvan changed the title Changes type avoiding undefined behaviour shifting left negative value Changes type avoiding undefined behaviour shifting left negative value in CFTimeZone Jun 4, 2020
@spevans
Copy link
Contributor

spevans commented Jun 18, 2020

Does this need a return (uint32_t)result to cast the result to the correct return type ?

@spevans
Copy link
Contributor

spevans commented Jun 18, 2020

@swift-ci test

@valeriyvan
Copy link
Contributor Author

Does this need a return (uint32_t)result to cast the result to the correct return type ?

No. Implicit cast from unsigned to signed of same size in not undefined behaviour. It is implementation-defined. Which means different compilers might legitimately do this differently.

We could add explicit cast to make intention clear. But anyway, it stays implementation-defined.

@spevans
Copy link
Contributor

spevans commented Jun 19, 2020

@swift-ci test

1 similar comment
@spevans
Copy link
Contributor

spevans commented Jun 19, 2020

@swift-ci test

@spevans
Copy link
Contributor

spevans commented Jun 19, 2020

@swift-ci test macos

@spevans
Copy link
Contributor

spevans commented Jun 21, 2020

@swift-ci test and merge

@swift-ci swift-ci merged commit 19a8e4e into swiftlang:master Jun 21, 2020
@valeriyvan valeriyvan deleted the CFTimeZone branch August 21, 2020 17:56
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