summaryrefslogtreecommitdiff
path: root/libgfortran/generated/count_4_l.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/generated/count_4_l.c')
-rw-r--r--libgfortran/generated/count_4_l.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libgfortran/generated/count_4_l.c b/libgfortran/generated/count_4_l.c
index 82926bd522e..6bdc9ca18bf 100644
--- a/libgfortran/generated/count_4_l.c
+++ b/libgfortran/generated/count_4_l.c
@@ -57,6 +57,7 @@ count_4_l (gfc_array_i4 * const restrict retarray,
index_type delta;
index_type dim;
int src_kind;
+ int continue_loop;
/* Make dim zero based to avoid confusion. */
dim = (*pdim) - 1;
@@ -65,6 +66,9 @@ count_4_l (gfc_array_i4 * const restrict retarray,
src_kind = GFC_DESCRIPTOR_SIZE (array);
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ if (len < 0)
+ len = 0;
+
delta = array->dim[dim].stride * src_kind;
for (n = 0; n < dim; n++)
@@ -164,7 +168,8 @@ count_4_l (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
- while (base)
+ continue_loop = 1;
+ while (continue_loop)
{
const GFC_LOGICAL_1 * restrict src;
GFC_INTEGER_4 result;
@@ -203,7 +208,7 @@ count_4_l (gfc_array_i4 * const restrict retarray,
if (n == rank)
{
/* Break out of the look. */
- base = NULL;
+ continue_loop = 0;
break;
}
else