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
This commit is contained in:
Jerry DeLisle 2008-04-20 21:06:16 +00:00
parent 8c154b6557
commit 49339fa475
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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;