[patch, libfortran] PR35991 run-time abort for CSHIFT of zero sized array

Jerry DeLisle jvdelisle@verizon.net
Sun Apr 20 20:40:00 GMT 2008


I plan to commit this patch as obvious.

Regression tested on x86-64.

Jerry

Index: cshift0.c
===================================================================
--- cshift0.c   (revision 134473)
+++ cshift0.c   (working copy)
@@ -202,7 +202,7 @@ cshift0 (gfc_array_char * ret, const gfc
    rptr = ret->data;
    sptr = array->data;

-  shift = shift % (ssize_t)len;
+  shift = len == 0 ? 0 : shift % (ssize_t)len;
    if (shift < 0)
      shift += len;



More information about the Fortran mailing list