diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2008-04-20 21:06:16 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2008-04-20 21:06:16 +0000 |
commit | 49339fa475b6644efaffa2dd85126d171e125297 (patch) | |
tree | f392bf9a9962fd4049778c221da2165cfc7cf5b9 /libgfortran | |
parent | 8c154b65579602aad087eff7229a460412b9ed8c (diff) | |
download | gcc-49339fa475b6644efaffa2dd85126d171e125297.zip gcc-49339fa475b6644efaffa2dd85126d171e125297.tar.gz gcc-49339fa475b6644efaffa2dd85126d171e125297.tar.bz2 |
re PR fortran/35991 (run-time abort for CSHIFT of zero sized array)
2008-04-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35991
* intrinsics/cshift0.c (cshift0): Avoid divide by zero.
From-SVN: r134491
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 5 | ||||
-rw-r--r-- | libgfortran/intrinsics/cshift0.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 922eef7..8ef3e0f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2008-04-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/35991 + * intrinsics/cshift0.c (cshift0): Avoid divide by zero. + 2008-04-20 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/35960 diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c index 75762a8..aa466ff 100644 --- a/libgfortran/intrinsics/cshift0.c +++ b/libgfortran/intrinsics/cshift0.c @@ -202,7 +202,7 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, rptr = ret->data; sptr = array->data; - shift = shift % (ssize_t)len; + shift = len == 0 ? 0 : shift % (ssize_t)len; if (shift < 0) shift += len; |