[Bug libfortran/34980] [4.3 Regression] Segfault in shape given a scalar

jvdelisle at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Jan 26 10:10:00 GMT 2008



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2008-01-26 09:00 -------
Index: libgfortran/generated/shape_i4.c
===================================================================
--- libgfortran/generated/shape_i4.c    (revision 131856)
+++ libgfortran/generated/shape_i4.c    (working copy)
@@ -46,6 +46,8 @@ shape_4 (gfc_array_i4 * const restrict r
   int n;
   index_type stride;

+  if (ret->data == NULL)
+    return;
   stride = ret->dim[0].stride;

   for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)

Something like the above fixes this.  Since this is generated, some m4 magic is
needed.  Also it seems that this could be simplified quite a bit in the
frontend and not make the call at all.


-- 


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



More information about the Gcc-bugs mailing list