diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-02-23 13:38:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-23 13:38:13 (GMT) |
commit | 7e8f270205a617fc0043fd2a45a1aece713e9e7d (patch) | |
tree | 8dbcb70cb8f7171cf9b12c2a04ab7987ab746e45 | |
parent | f4636d554fc737dacc81a115e7e64ccbfe830d79 (diff) | |
download | hdf5-7e8f270205a617fc0043fd2a45a1aece713e9e7d.zip hdf5-7e8f270205a617fc0043fd2a45a1aece713e9e7d.tar.gz hdf5-7e8f270205a617fc0043fd2a45a1aece713e9e7d.tar.bz2 |
Merge "Fix undefined left shifting of negative numbers" (#338) to hdf5_1_10 (#370)
* close #195. (#196)
* Update HDF5PluginMacros.cmake
* Update HDF5PluginMacros.cmake
* Modify temporary rpath for testing in java example scripts. (#230)
* Fix undefined left shifting of negative numbers (#338)
Undefined Bahavior Sanitizer errored here about left shifting negative numbers.
Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org>
Co-authored-by: Sean McBride <sean@rogue-research.com>
-rw-r--r-- | test/dsets.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/dsets.c b/test/dsets.c index 0094a0f..3177f37 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -4041,7 +4041,7 @@ test_nbit_compound_2(hid_t file) power = HDpow(2.0F, (double)(precision[1] - 1)); orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); power = HDpow(2.0F, (double)(precision[2] - 1)); - orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]); + orig_data[i][j].a.s = (short)(-(((long long)HDrandom() % (long long)power) << offset[2])); orig_data[i][j].a.f = float_val[i][j]; power = HDpow(2.0F, (double)precision[3]); @@ -4057,7 +4057,7 @@ test_nbit_compound_2(hid_t file) for (n = 0; n < (size_t)array_dims[1]; n++) { power = HDpow(2.0F, (double)(precision[0] - 1)); orig_data[i][j].d[m][n].i = - (int)(-((long long)HDrandom() % (long long)power) << offset[0]); + (int)(-(((long long)HDrandom() % (long long)power) << offset[0])); power = HDpow(2.0F, (double)(precision[1] - 1)); orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]); |