From: Jerry DeLisle Date: Sun, 20 Apr 2008 21:06:16 +0000 (+0000) Subject: re PR fortran/35991 (run-time abort for CSHIFT of zero sized array) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=49339fa475b6644efaffa2dd85126d171e125297;p=gcc.git re PR fortran/35991 (run-time abort for CSHIFT of zero sized array) 2008-04-20 Jerry DeLisle PR fortran/35991 * intrinsics/cshift0.c (cshift0): Avoid divide by zero. From-SVN: r134491 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 922eef795d2..8ef3e0fc55e 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2008-04-20 Jerry DeLisle + + PR fortran/35991 + * intrinsics/cshift0.c (cshift0): Avoid divide by zero. + 2008-04-20 Thomas Koenig PR libfortran/35960 diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c index 75762a8158f..aa466ff3b6b 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;