diff options
Diffstat (limited to 'libgfortran/generated/shape_i4.c')
-rw-r--r-- | libgfortran/generated/shape_i4.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c index 787ba544c21..64a6fcdb994 100644 --- a/libgfortran/generated/shape_i4.c +++ b/libgfortran/generated/shape_i4.c @@ -45,6 +45,7 @@ shape_4 (gfc_array_i4 * const restrict ret, { int n; index_type stride; + index_type extent; stride = ret->dim[0].stride; @@ -53,8 +54,8 @@ shape_4 (gfc_array_i4 * const restrict ret, 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 ; } } |