aboutsummaryrefslogtreecommitdiff
path: root/libmpx/mpxwrap/mpx_wrappers.c
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2016-06-13 19:17:11 +0000
committerMichael Meissner <meissner@linux.vnet.ibm.com>2016-06-13 19:17:11 +0000
commit96f074375cbd78b6d762d5c0896ff9b4be1ffdd6 (patch)
treee942205a85b1a2f2bd259b3da2e31b7303905c69 /libmpx/mpxwrap/mpx_wrappers.c
parent342a6bf41b8a442ff4325d51d6ee59a4f1402ff6 (diff)
parentc7a32e1a058ac615030cdedc9194ac4d3bda0604 (diff)
Merge up to 237393ibm/stage-test
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/stage-test@237398 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libmpx/mpxwrap/mpx_wrappers.c')
-rw-r--r--libmpx/mpxwrap/mpx_wrappers.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libmpx/mpxwrap/mpx_wrappers.c b/libmpx/mpxwrap/mpx_wrappers.c
index d4c83ef484c..171a780311d 100644
--- a/libmpx/mpxwrap/mpx_wrappers.c
+++ b/libmpx/mpxwrap/mpx_wrappers.c
@@ -27,6 +27,7 @@
#include "string.h"
#include <sys/mman.h>
#include <stdint.h>
+#include <assert.h>
#include "mpxrt/mpxrt.h"
void *
@@ -418,7 +419,16 @@ move_bounds (void *dst, const void *src, size_t n)
else
elems_to_copy -= src_bt_index_end + 1;
}
- src_bd_index_end--;
+ /* Go to previous table but beware of overflow.
+ We should have copied all required element
+ in case src_bd_index_end is 0. */
+ if (src_bd_index_end)
+ src_bd_index_end--;
+ else
+ {
+ assert (!elems_to_copy);
+ return;
+ }
/* For each bounds table we check if there are valid pointers inside.
If there are some, we copy table in pre-counted portions. */
for (; src_bd_index_end > src_bd_index; src_bd_index_end--)