diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-10-06 11:45:05 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-10-06 11:45:05 +0000 |
commit | f64b9ed94ccf6ee21b769a7213def41918d793a1 (patch) | |
tree | 3d0da4751f218c71c5f5f1f5bbcc3805ebdfc9f5 /gcc/fortran/simplify.c | |
parent | a141f2d86293dc202e35bd4d7f832756e1792cdf (diff) | |
download | gcc-f64b9ed94ccf6ee21b769a7213def41918d793a1.zip gcc-f64b9ed94ccf6ee21b769a7213def41918d793a1.tar.gz gcc-f64b9ed94ccf6ee21b769a7213def41918d793a1.tar.bz2 |
re PR fortran/84640 (gcc/fortran/simplify.c:2587:9: runtime error: pointer index expression with base 0x0000090de160 overflowed to 0xffffffffc0632960)
2018-10-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84640
* simplify.c (gfc_simplify_cshift): Extend size of hs_ex and ss_ex
by one. Set extents one past the array boundaries to zero to avoid
warning with instrumented compiler.
(gfc_simplify_eoshift): Likewise, only for ss_ex.
From-SVN: r264898
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r-- | gcc/fortran/simplify.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index d35bbba..7bdd23d 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -2011,11 +2011,11 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim) ssize_t *shiftvec, *hptr; ssize_t shift_val, len; ssize_t count[GFC_MAX_DIMENSIONS], extent[GFC_MAX_DIMENSIONS], - hs_ex[GFC_MAX_DIMENSIONS], + hs_ex[GFC_MAX_DIMENSIONS + 1], hstride[GFC_MAX_DIMENSIONS], sstride[GFC_MAX_DIMENSIONS], a_extent[GFC_MAX_DIMENSIONS], a_stride[GFC_MAX_DIMENSIONS], h_extent[GFC_MAX_DIMENSIONS], - ss_ex[GFC_MAX_DIMENSIONS]; + ss_ex[GFC_MAX_DIMENSIONS + 1]; ssize_t rsoffset; int d, n; bool continue_loop; @@ -2110,6 +2110,8 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim) n++; } } + ss_ex[n] = 0; + hs_ex[n] = 0; if (shiftvec) { @@ -2403,7 +2405,7 @@ gfc_simplify_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary, ssize_t shift_val, len; ssize_t count[GFC_MAX_DIMENSIONS], extent[GFC_MAX_DIMENSIONS], sstride[GFC_MAX_DIMENSIONS], a_extent[GFC_MAX_DIMENSIONS], - a_stride[GFC_MAX_DIMENSIONS], ss_ex[GFC_MAX_DIMENSIONS]; + a_stride[GFC_MAX_DIMENSIONS], ss_ex[GFC_MAX_DIMENSIONS + 1]; ssize_t rsoffset; int d, n; bool continue_loop; @@ -2546,6 +2548,7 @@ gfc_simplify_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary, n++; } } + ss_ex[n] = 0; continue_loop = true; d = array->rank; |