This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/35991] run-time abort for CSHIFT of zero sized array



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2008-04-20 20:16 -------
This obvious patch fixes it.

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;



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35991


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]