diff options
author | Sean McBride <sean@rogue-research.com> | 2021-02-19 18:48:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-19 18:48:04 (GMT) |
commit | 5f015f474250cb632890e3ddc8d12461c0e2a476 (patch) | |
tree | f0dcca3e3cd893e5279840dc747d5116b595fb0d | |
parent | 0a2a385accd2fc18c17bc3e36fd38f6a802e38df (diff) | |
download | hdf5-5f015f474250cb632890e3ddc8d12461c0e2a476.zip hdf5-5f015f474250cb632890e3ddc8d12461c0e2a476.tar.gz hdf5-5f015f474250cb632890e3ddc8d12461c0e2a476.tar.bz2 |
Fix undefined left shifting of negative numbers (#338)
Undefined Bahavior Sanitizer errored here about left shifting negative numbers.
-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 d79e3bb..5dcdbce 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]); |