Parallel-NetCDF / PnetCDF

Source code repository of PnetCDF library and utilities
https://parallel-netcdf.github.io
Other
80 stars 22 forks source link

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

Closed wkliao closed 9 months ago

wkliao commented 9 months ago

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.