Skip to content

use unsigned int to do byte swap (misaligned memory access) #113

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
Dec 7, 2023

Conversation

wkliao
Copy link
Member

@wkliao wkliao commented Dec 6, 2023

When compiling with C flag '-fsanitize=undefined', a runtime error may appear
with messages like below.

runtime error: left shift of 1618607871 by 8 places cannot be represented in type 'int'

This issue was reported in NetCDF repo, issue #2796.
The fix in PR #2800 appears to be able to resolve it.

Looks like it is necessary to use unsigned int when doing byte swap.

@wkliao wkliao merged commit 3bdb265 into master Dec 7, 2023
@wkliao wkliao deleted the byte_swap4 branch March 15, 2024 18:19
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.

1 participant