summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-02-23 13:39:15 (GMT)
committerGitHub <noreply@github.com>2021-02-23 13:39:15 (GMT)
commitd1475f524507186ad393ae2f1a93fba8126a4881 (patch)
tree9cc0182e7cbdb6e48c48664af24e0679c1db5cc2
parentdf1a4af96126682ea4a05c2b26bf6b7c916579ff (diff)
downloadhdf5-d1475f524507186ad393ae2f1a93fba8126a4881.zip
hdf5-d1475f524507186ad393ae2f1a93fba8126a4881.tar.gz
hdf5-d1475f524507186ad393ae2f1a93fba8126a4881.tar.bz2
Merge ""Fix undefined left shifting of negative numbers" (#338) to hdf5_1_ 8 (#371)
* close #195. (#196) * Update HDF5PluginMacros.cmake * Update HDF5PluginMacros.cmake * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add script bin/switch_maint_mode. Add file changes generated by bin reconfigure in src/H5Edefin.h src/H5Einit.h src/H5Epubgen.h src/H5Eterm.h * Update MANIFEST for switch_maint_mode. * Update so numbers to match 1.8.22 release. * Updated configure with reconfigure. * Updates and corrections following HDF5 1.8.22 release. * Commit Makefile.ins with so version numbers updated by bin/reconfigure. * 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: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Sean McBride <sean@rogue-research.com>
-rw-r--r--test/dsets.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/dsets.c b/test/dsets.c
index cfbcbec..c2fe130 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -3760,7 +3760,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]);
@@ -3776,7 +3776,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]);