This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/35001] shape for negative sizes
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Jan 2008 21:10:28 -0000
- Subject: [Bug libfortran/35001] shape for negative sizes
- References: <bug-35001-10391@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from tkoenig at gcc dot gnu dot org 2008-01-31 21:10 -------
A patch for when trunk reopens.
Index: m4/shape.m4
===================================================================
--- m4/shape.m4 (revision 131915)
+++ m4/shape.m4 (working copy)
@@ -46,6 +46,7 @@ shape_'rtype_kind` ('rtype` * const rest
{
int n;
index_type stride;
+ index_type extent;
stride = ret->dim[0].stride;
@@ -54,8 +55,8 @@ shape_'rtype_kind` ('rtype` * const rest
for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
{
- ret->data[n * stride] =
- array->dim[n].ubound + 1 - array->dim[n].lbound;
+ extent = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ ret->data[n * stride] = extent > 0 ? extent : 0 ;
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35001