diff options
118 files changed, 976 insertions, 329 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9bf58a970a5..11fb08ced85 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/35995 + * gfortran.dg/intrinsic_ifunction_1.f90: New test case. + 2008-05-04 Andy Hutchinson <hutchinsonandy@aim.com> * gcc.dg/nested-func-5.c: Skip for target without trampolines. diff --git a/gcc/testsuite/gfortran.dg/intrinsic_ifunction_1.f90 b/gcc/testsuite/gfortran.dg/intrinsic_ifunction_1.f90 new file mode 100644 index 00000000000..a27c220ee46 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intrinsic_ifunction_1.f90 @@ -0,0 +1,43 @@ +! { dg-do run } +! PR 35995 - ifunction.m4 and ifunction_logical.m4 had a bug +! where zero-sized arguments were not handled correctly. +! Test case provided by Dick Hendrickson, amended by +! Thomas Koenig. + + program try_gf0026_etc + + call gf0026( 0, 1) + call foo ( 0, 1) + + end program + + SUBROUTINE GF0026(nf0,nf1) + LOGICAL LDA(9) + INTEGER IDA(NF0,9), iii(9) + + lda = (/ (i/2*2 .eq. I, i=1,9) /) + LDA = ALL ( IDA .NE. -1000, 1) + if (.not. all(lda)) call abort + if (.not. all(ida .ne. -1000)) call abort + + lda = (/ (i/2*2 .eq. I, i=1,9) /) + LDA = any ( IDA .NE. -1000, 1) + print *, lda !expect FALSE + if (any(lda)) call abort + print *, any(ida .ne. -1000) !expect FALSE + if (any(ida .ne. -1000)) call abort + + iii = 137 + iii = count ( IDA .NE. -1000, 1) + if (any(iii /= 0)) call abort + if (count(ida .ne. -1000) /= 0) call abort + + END SUBROUTINE + + subroutine foo (nf0, nf1) + integer, dimension(9):: res, iii + integer, dimension(nf0,9) :: ida + res = (/ (-i, i=1,9) /) + res = product (ida, 1) + if (any(res /= 1)) call abort + end subroutine foo diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index ec9ab88b753..9da45d503c5 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,5 +1,128 @@ 2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org> + PR libfortran/35995 + * m4/ifunction_logical.m4: If the extent of "array" + is less than zero, set it to zero. Use an explicit + flag for breaking out of the main loop to avoid, because + the data pointer for "array" may be NULL for an empty + array. + * m4/ifunction.m4: Likewise. + * generated/all_l1.c: Regenerated. + * generated/all_l16.c: Regenerated. + * generated/all_l2.c: Regenerated. + * generated/all_l4.c: Regenerated. + * generated/all_l8.c: Regenerated. + * generated/any_l1.c: Regenerated. + * generated/any_l16.c: Regenerated. + * generated/any_l2.c: Regenerated. + * generated/any_l4.c: Regenerated. + * generated/any_l8.c: Regenerated. + * generated/count_16_l.c: Regenerated. + * generated/count_1_l.c: Regenerated. + * generated/count_2_l.c: Regenerated. + * generated/count_4_l.c: Regenerated. + * generated/count_8_l.c: Regenerated. + * generated/maxloc1_16_i1.c: Regenerated. + * generated/maxloc1_16_i16.c: Regenerated. + * generated/maxloc1_16_i2.c: Regenerated. + * generated/maxloc1_16_i4.c: Regenerated. + * generated/maxloc1_16_i8.c: Regenerated. + * generated/maxloc1_16_r10.c: Regenerated. + * generated/maxloc1_16_r16.c: Regenerated. + * generated/maxloc1_16_r4.c: Regenerated. + * generated/maxloc1_16_r8.c: Regenerated. + * generated/maxloc1_4_i1.c: Regenerated. + * generated/maxloc1_4_i16.c: Regenerated. + * generated/maxloc1_4_i2.c: Regenerated. + * generated/maxloc1_4_i4.c: Regenerated. + * generated/maxloc1_4_i8.c: Regenerated. + * generated/maxloc1_4_r10.c: Regenerated. + * generated/maxloc1_4_r16.c: Regenerated. + * generated/maxloc1_4_r4.c: Regenerated. + * generated/maxloc1_4_r8.c: Regenerated. + * generated/maxloc1_8_i1.c: Regenerated. + * generated/maxloc1_8_i16.c: Regenerated. + * generated/maxloc1_8_i2.c: Regenerated. + * generated/maxloc1_8_i4.c: Regenerated. + * generated/maxloc1_8_i8.c: Regenerated. + * generated/maxloc1_8_r10.c: Regenerated. + * generated/maxloc1_8_r16.c: Regenerated. + * generated/maxloc1_8_r4.c: Regenerated. + * generated/maxloc1_8_r8.c: Regenerated. + * generated/maxval_i1.c: Regenerated. + * generated/maxval_i16.c: Regenerated. + * generated/maxval_i2.c: Regenerated. + * generated/maxval_i4.c: Regenerated. + * generated/maxval_i8.c: Regenerated. + * generated/maxval_r10.c: Regenerated. + * generated/maxval_r16.c: Regenerated. + * generated/maxval_r4.c: Regenerated. + * generated/maxval_r8.c: Regenerated. + * generated/minloc1_16_i1.c: Regenerated. + * generated/minloc1_16_i16.c: Regenerated. + * generated/minloc1_16_i2.c: Regenerated. + * generated/minloc1_16_i4.c: Regenerated. + * generated/minloc1_16_i8.c: Regenerated. + * generated/minloc1_16_r10.c: Regenerated. + * generated/minloc1_16_r16.c: Regenerated. + * generated/minloc1_16_r4.c: Regenerated. + * generated/minloc1_16_r8.c: Regenerated. + * generated/minloc1_4_i1.c: Regenerated. + * generated/minloc1_4_i16.c: Regenerated. + * generated/minloc1_4_i2.c: Regenerated. + * generated/minloc1_4_i4.c: Regenerated. + * generated/minloc1_4_i8.c: Regenerated. + * generated/minloc1_4_r10.c: Regenerated. + * generated/minloc1_4_r16.c: Regenerated. + * generated/minloc1_4_r4.c: Regenerated. + * generated/minloc1_4_r8.c: Regenerated. + * generated/minloc1_8_i1.c: Regenerated. + * generated/minloc1_8_i16.c: Regenerated. + * generated/minloc1_8_i2.c: Regenerated. + * generated/minloc1_8_i4.c: Regenerated. + * generated/minloc1_8_i8.c: Regenerated. + * generated/minloc1_8_r10.c: Regenerated. + * generated/minloc1_8_r16.c: Regenerated. + * generated/minloc1_8_r4.c: Regenerated. + * generated/minloc1_8_r8.c: Regenerated. + * generated/minval_i1.c: Regenerated. + * generated/minval_i16.c: Regenerated. + * generated/minval_i2.c: Regenerated. + * generated/minval_i4.c: Regenerated. + * generated/minval_i8.c: Regenerated. + * generated/minval_r10.c: Regenerated. + * generated/minval_r16.c: Regenerated. + * generated/minval_r4.c: Regenerated. + * generated/minval_r8.c: Regenerated. + * generated/product_c10.c: Regenerated. + * generated/product_c16.c: Regenerated. + * generated/product_c4.c: Regenerated. + * generated/product_c8.c: Regenerated. + * generated/product_i1.c: Regenerated. + * generated/product_i16.c: Regenerated. + * generated/product_i2.c: Regenerated. + * generated/product_i4.c: Regenerated. + * generated/product_i8.c: Regenerated. + * generated/product_r10.c: Regenerated. + * generated/product_r16.c: Regenerated. + * generated/product_r4.c: Regenerated. + * generated/product_r8.c: Regenerated. + * generated/sum_c10.c: Regenerated. + * generated/sum_c16.c: Regenerated. + * generated/sum_c4.c: Regenerated. + * generated/sum_c8.c: Regenerated. + * generated/sum_i1.c: Regenerated. + * generated/sum_i16.c: Regenerated. + * generated/sum_i2.c: Regenerated. + * generated/sum_i4.c: Regenerated. + * generated/sum_i8.c: Regenerated. + * generated/sum_r10.c: Regenerated. + * generated/sum_r16.c: Regenerated. + * generated/sum_r4.c: Regenerated. + * generated/sum_r8.c: Regenerated. + +2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org> + PR libfortran/35990 * intrinsics/pack_generic.c: Really commit. diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c index 385726af399..8345adc1f6e 100644 --- a/libgfortran/generated/all_l1.c +++ b/libgfortran/generated/all_l1.c @@ -57,6 +57,7 @@ all_l1 (gfc_array_l1 * 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 @@ all_l1 (gfc_array_l1 * 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 @@ all_l1 (gfc_array_l1 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_1 result; @@ -207,7 +212,7 @@ all_l1 (gfc_array_l1 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c index fd6a9f0b715..ee6f8f93c9f 100644 --- a/libgfortran/generated/all_l16.c +++ b/libgfortran/generated/all_l16.c @@ -57,6 +57,7 @@ all_l16 (gfc_array_l16 * 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 @@ all_l16 (gfc_array_l16 * 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 @@ all_l16 (gfc_array_l16 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_16 result; @@ -207,7 +212,7 @@ all_l16 (gfc_array_l16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/all_l2.c b/libgfortran/generated/all_l2.c index 16b4ec94ea1..dd069c57d61 100644 --- a/libgfortran/generated/all_l2.c +++ b/libgfortran/generated/all_l2.c @@ -57,6 +57,7 @@ all_l2 (gfc_array_l2 * 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 @@ all_l2 (gfc_array_l2 * 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 @@ all_l2 (gfc_array_l2 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_2 result; @@ -207,7 +212,7 @@ all_l2 (gfc_array_l2 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c index ef8bdcdddba..00a0896f669 100644 --- a/libgfortran/generated/all_l4.c +++ b/libgfortran/generated/all_l4.c @@ -57,6 +57,7 @@ all_l4 (gfc_array_l4 * 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 @@ all_l4 (gfc_array_l4 * 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 @@ all_l4 (gfc_array_l4 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_4 result; @@ -207,7 +212,7 @@ all_l4 (gfc_array_l4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c index 8e7a659a283..b08c19cdba5 100644 --- a/libgfortran/generated/all_l8.c +++ b/libgfortran/generated/all_l8.c @@ -57,6 +57,7 @@ all_l8 (gfc_array_l8 * 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 @@ all_l8 (gfc_array_l8 * 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 @@ all_l8 (gfc_array_l8 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_8 result; @@ -207,7 +212,7 @@ all_l8 (gfc_array_l8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/any_l1.c b/libgfortran/generated/any_l1.c index 8975438ae59..2d11eb1a3b4 100644 --- a/libgfortran/generated/any_l1.c +++ b/libgfortran/generated/any_l1.c @@ -57,6 +57,7 @@ any_l1 (gfc_array_l1 * 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 @@ any_l1 (gfc_array_l1 * 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 @@ any_l1 (gfc_array_l1 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_1 result; @@ -207,7 +212,7 @@ any_l1 (gfc_array_l1 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c index 060a4b82127..3d7cd1b1ef9 100644 --- a/libgfortran/generated/any_l16.c +++ b/libgfortran/generated/any_l16.c @@ -57,6 +57,7 @@ any_l16 (gfc_array_l16 * 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 @@ any_l16 (gfc_array_l16 * 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 @@ any_l16 (gfc_array_l16 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_16 result; @@ -207,7 +212,7 @@ any_l16 (gfc_array_l16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/any_l2.c b/libgfortran/generated/any_l2.c index 73db5aea082..1c874182b3e 100644 --- a/libgfortran/generated/any_l2.c +++ b/libgfortran/generated/any_l2.c @@ -57,6 +57,7 @@ any_l2 (gfc_array_l2 * 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 @@ any_l2 (gfc_array_l2 * 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 @@ any_l2 (gfc_array_l2 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_2 result; @@ -207,7 +212,7 @@ any_l2 (gfc_array_l2 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c index 3e239cab106..71a8cb0e63f 100644 --- a/libgfortran/generated/any_l4.c +++ b/libgfortran/generated/any_l4.c @@ -57,6 +57,7 @@ any_l4 (gfc_array_l4 * 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 @@ any_l4 (gfc_array_l4 * 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 @@ any_l4 (gfc_array_l4 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_4 result; @@ -207,7 +212,7 @@ any_l4 (gfc_array_l4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c index 3ea80dd3e31..55ff7a601b0 100644 --- a/libgfortran/generated/any_l8.c +++ b/libgfortran/generated/any_l8.c @@ -57,6 +57,7 @@ any_l8 (gfc_array_l8 * 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 @@ any_l8 (gfc_array_l8 * 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 @@ any_l8 (gfc_array_l8 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_LOGICAL_8 result; @@ -207,7 +212,7 @@ any_l8 (gfc_array_l8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/count_16_l.c b/libgfortran/generated/count_16_l.c index 654c5495dec..638fb179e25 100644 --- a/libgfortran/generated/count_16_l.c +++ b/libgfortran/generated/count_16_l.c @@ -57,6 +57,7 @@ count_16_l (gfc_array_i16 * 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_16_l (gfc_array_i16 * 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_16_l (gfc_array_i16 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_INTEGER_16 result; @@ -203,7 +208,7 @@ count_16_l (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/count_1_l.c b/libgfortran/generated/count_1_l.c index ab2d0eac21a..52ae34baa5f 100644 --- a/libgfortran/generated/count_1_l.c +++ b/libgfortran/generated/count_1_l.c @@ -57,6 +57,7 @@ count_1_l (gfc_array_i1 * 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_1_l (gfc_array_i1 * 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_1_l (gfc_array_i1 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_INTEGER_1 result; @@ -203,7 +208,7 @@ count_1_l (gfc_array_i1 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/count_2_l.c b/libgfortran/generated/count_2_l.c index bb29d4f3c4f..ddede7160f5 100644 --- a/libgfortran/generated/count_2_l.c +++ b/libgfortran/generated/count_2_l.c @@ -57,6 +57,7 @@ count_2_l (gfc_array_i2 * 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_2_l (gfc_array_i2 * 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_2_l (gfc_array_i2 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_INTEGER_2 result; @@ -203,7 +208,7 @@ count_2_l (gfc_array_i2 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else 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 diff --git a/libgfortran/generated/count_8_l.c b/libgfortran/generated/count_8_l.c index 9cb094f81cd..3c1c5653610 100644 --- a/libgfortran/generated/count_8_l.c +++ b/libgfortran/generated/count_8_l.c @@ -57,6 +57,7 @@ count_8_l (gfc_array_i8 * 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_8_l (gfc_array_i8 * 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_8_l (gfc_array_i8 * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; GFC_INTEGER_8 result; @@ -203,7 +208,7 @@ count_8_l (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c index 6e4153c3eb9..7cccedae55b 100644 --- a/libgfortran/generated/maxloc1_16_i1.c +++ b/libgfortran/generated/maxloc1_16_i1.c @@ -57,12 +57,15 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index b4fd55d6350..d7126afbcce 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -57,12 +57,15 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c index 483b90372ee..278ef5b5eb9 100644 --- a/libgfortran/generated/maxloc1_16_i2.c +++ b/libgfortran/generated/maxloc1_16_i2.c @@ -57,12 +57,15 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index 69d35d75556..4e2e73114d3 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -57,12 +57,15 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index 54d016c2d51..1a9eb519adb 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -57,12 +57,15 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index 10ea86849e5..79805f5519b 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -57,12 +57,15 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 54b2aeb90eb..49b27c34227 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -57,12 +57,15 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index f9712e6082a..cb4cc17f78c 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -57,12 +57,15 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index 1e836288439..bddedbe63fa 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -57,12 +57,15 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c index 271ef38e3f2..3a1ae07de92 100644 --- a/libgfortran/generated/maxloc1_4_i1.c +++ b/libgfortran/generated/maxloc1_4_i1.c @@ -57,12 +57,15 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index 627e36030c4..d9e1b3e527f 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -57,12 +57,15 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c index cf42ddfc708..dedb28b8dc0 100644 --- a/libgfortran/generated/maxloc1_4_i2.c +++ b/libgfortran/generated/maxloc1_4_i2.c @@ -57,12 +57,15 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index a26180f4e7f..12bad843e92 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -57,12 +57,15 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index 40f2c36a93d..2215521cb1b 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -57,12 +57,15 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index 75497022d76..0ed1df2fde0 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -57,12 +57,15 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index 3ed0d96671e..ae1a4f16fab 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -57,12 +57,15 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index 24ecf9a40e6..6b1656424cd 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -57,12 +57,15 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index 9a695da2b29..bbc6f9e54e5 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -57,12 +57,15 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c index 489ed11a8fc..85c44f9d0dc 100644 --- a/libgfortran/generated/maxloc1_8_i1.c +++ b/libgfortran/generated/maxloc1_8_i1.c @@ -57,12 +57,15 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index 9f8c7ad01ff..18d1ad1d2f2 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -57,12 +57,15 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c index 28e01639198..121cc0fe8cb 100644 --- a/libgfortran/generated/maxloc1_8_i2.c +++ b/libgfortran/generated/maxloc1_8_i2.c @@ -57,12 +57,15 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index 82038dc4745..8386a29979e 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -57,12 +57,15 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index c7301eab6c1..ed71c492502 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -57,12 +57,15 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index d83600d6019..a7b71bc54f3 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -57,12 +57,15 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index 6d45297df77..9fd0b46dbda 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -57,12 +57,15 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index 470d73c1ea3..79f1103dc8f 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -57,12 +57,15 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index 7003594e00c..b0ab7608b41 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -57,12 +57,15 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c index 9468e4aad4a..a7288eb827b 100644 --- a/libgfortran/generated/maxval_i1.c +++ b/libgfortran/generated/maxval_i1.c @@ -56,12 +56,15 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_1 result; @@ -187,8 +191,8 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index de2cac8c113..d50ab6f3558 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -56,12 +56,15 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_16 result; @@ -187,8 +191,8 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c index 818fc29e889..c49b1812043 100644 --- a/libgfortran/generated/maxval_i2.c +++ b/libgfortran/generated/maxval_i2.c @@ -56,12 +56,15 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_2 result; @@ -187,8 +191,8 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index e5289f1e1d8..354c86d9a1e 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -56,12 +56,15 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_4 result; @@ -187,8 +191,8 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index d05737d66f1..91a2b00c619 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -56,12 +56,15 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_8 result; @@ -187,8 +191,8 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index 921ad487d47..c959a8083a6 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -56,12 +56,15 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_REAL_10 result; @@ -187,8 +191,8 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index 15bdd7e215a..a05808d2e5c 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -56,12 +56,15 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_REAL_16 result; @@ -187,8 +191,8 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index f3470e8b951..a00468bc845 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -56,12 +56,15 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_REAL_4 result; @@ -187,8 +191,8 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index b5d7f3c0d52..1c9e41df6d0 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -56,12 +56,15 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_REAL_8 result; @@ -187,8 +191,8 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c index 8a20d7b453c..f95aa906897 100644 --- a/libgfortran/generated/minloc1_16_i1.c +++ b/libgfortran/generated/minloc1_16_i1.c @@ -57,12 +57,15 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index f0c5b84384a..9a5da308ede 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -57,12 +57,15 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c index 234f364880a..ad282f9b774 100644 --- a/libgfortran/generated/minloc1_16_i2.c +++ b/libgfortran/generated/minloc1_16_i2.c @@ -57,12 +57,15 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index 2b55cff40b8..7eb382d89ee 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -57,12 +57,15 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index 2e2e89407c0..7995d26101c 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -57,12 +57,15 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index dcf291f6453..c7da9d1b5dc 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -57,12 +57,15 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index eb496134df7..c24cb81dca5 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -57,12 +57,15 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index dd39b5dd02c..37cda9b2c1c 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -57,12 +57,15 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index e31410f0cec..b0bbf82d313 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -57,12 +57,15 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_INTEGER_16 result; @@ -193,8 +197,8 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c index 5111c7d6f46..eab1b40109d 100644 --- a/libgfortran/generated/minloc1_4_i1.c +++ b/libgfortran/generated/minloc1_4_i1.c @@ -57,12 +57,15 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index db898320157..3446e4e825d 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -57,12 +57,15 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c index 3e1448dc50f..1e2a8c6652d 100644 --- a/libgfortran/generated/minloc1_4_i2.c +++ b/libgfortran/generated/minloc1_4_i2.c @@ -57,12 +57,15 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index b66c23edfc1..6e4b137f183 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -57,12 +57,15 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index 1eb3c4cbcf0..5295a1050c7 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -57,12 +57,15 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index a224fd3ef05..a020a9908a6 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -57,12 +57,15 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index 404be416cff..19bf03c3b75 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -57,12 +57,15 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index 4d9844ce633..ba54897ba39 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -57,12 +57,15 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index fc9b0aea239..07fb27a6606 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -57,12 +57,15 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_INTEGER_4 result; @@ -193,8 +197,8 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c index b0fbe0d946e..409a961a786 100644 --- a/libgfortran/generated/minloc1_8_i1.c +++ b/libgfortran/generated/minloc1_8_i1.c @@ -57,12 +57,15 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index 4c4a76c75de..47fc6665dec 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -57,12 +57,15 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c index f18cd2aea79..22080173f89 100644 --- a/libgfortran/generated/minloc1_8_i2.c +++ b/libgfortran/generated/minloc1_8_i2.c @@ -57,12 +57,15 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index 758249e0631..71df4e662e3 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -57,12 +57,15 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index 245522e579d..d4e471a62bb 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -57,12 +57,15 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index ae8035ee061..61632394d6c 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -57,12 +57,15 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index af4e2ea41b2..3e0416adb52 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -57,12 +57,15 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index 3f2b2e1dd4e..c6a6ad4bc55 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -57,12 +57,15 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index 5e00272ec9b..8a01e3edf26 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -57,12 +57,15 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -149,7 +152,8 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_INTEGER_8 result; @@ -193,8 +197,8 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c index 3815d44f8df..719a0497c6c 100644 --- a/libgfortran/generated/minval_i1.c +++ b/libgfortran/generated/minval_i1.c @@ -56,12 +56,15 @@ minval_i1 (gfc_array_i1 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_i1 (gfc_array_i1 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_1 result; @@ -187,8 +191,8 @@ minval_i1 (gfc_array_i1 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index b8b99d33529..c4f699b01b1 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -56,12 +56,15 @@ minval_i16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_i16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_16 result; @@ -187,8 +191,8 @@ minval_i16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c index 1e83efd024c..2ff292fe9b1 100644 --- a/libgfortran/generated/minval_i2.c +++ b/libgfortran/generated/minval_i2.c @@ -56,12 +56,15 @@ minval_i2 (gfc_array_i2 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_i2 (gfc_array_i2 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_2 result; @@ -187,8 +191,8 @@ minval_i2 (gfc_array_i2 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index a40fc2cfd77..96bfe32bde6 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -56,12 +56,15 @@ minval_i4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_i4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_4 result; @@ -187,8 +191,8 @@ minval_i4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index af37f4369af..1682dd2fa39 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -56,12 +56,15 @@ minval_i8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_i8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_8 result; @@ -187,8 +191,8 @@ minval_i8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index 829c630037b..fa9e6366e38 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -56,12 +56,15 @@ minval_r10 (gfc_array_r10 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_r10 (gfc_array_r10 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_REAL_10 result; @@ -187,8 +191,8 @@ minval_r10 (gfc_array_r10 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index c3797c7f537..9561caa94da 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -56,12 +56,15 @@ minval_r16 (gfc_array_r16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_r16 (gfc_array_r16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_REAL_16 result; @@ -187,8 +191,8 @@ minval_r16 (gfc_array_r16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index c8c8fd51809..ac048eedb06 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -56,12 +56,15 @@ minval_r4 (gfc_array_r4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_r4 (gfc_array_r4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_REAL_4 result; @@ -187,8 +191,8 @@ minval_r4 (gfc_array_r4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index e404b170b91..21ecb3c5afb 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -56,12 +56,15 @@ minval_r8 (gfc_array_r8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ minval_r8 (gfc_array_r8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_REAL_8 result; @@ -187,8 +191,8 @@ minval_r8 (gfc_array_r8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index 0366544a205..66a9c05dec7 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -56,12 +56,15 @@ product_c10 (gfc_array_c10 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_c10 (gfc_array_c10 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_10 * restrict src; GFC_COMPLEX_10 result; @@ -186,8 +190,8 @@ product_c10 (gfc_array_c10 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index c4612cf2059..ec2acb4e4f9 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -56,12 +56,15 @@ product_c16 (gfc_array_c16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_c16 (gfc_array_c16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_16 * restrict src; GFC_COMPLEX_16 result; @@ -186,8 +190,8 @@ product_c16 (gfc_array_c16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index 53c7f80b269..bd52eb9ab77 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -56,12 +56,15 @@ product_c4 (gfc_array_c4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_c4 (gfc_array_c4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_4 * restrict src; GFC_COMPLEX_4 result; @@ -186,8 +190,8 @@ product_c4 (gfc_array_c4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index 812fb3ba38e..c124355c1b2 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -56,12 +56,15 @@ product_c8 (gfc_array_c8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_c8 (gfc_array_c8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_8 * restrict src; GFC_COMPLEX_8 result; @@ -186,8 +190,8 @@ product_c8 (gfc_array_c8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c index 72b894f89c4..362a08ac6a1 100644 --- a/libgfortran/generated/product_i1.c +++ b/libgfortran/generated/product_i1.c @@ -56,12 +56,15 @@ product_i1 (gfc_array_i1 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_i1 (gfc_array_i1 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_1 result; @@ -186,8 +190,8 @@ product_i1 (gfc_array_i1 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index e04293179a8..a687c3a218e 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -56,12 +56,15 @@ product_i16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_i16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_16 result; @@ -186,8 +190,8 @@ product_i16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c index af3da57cf97..f8082b4c7bb 100644 --- a/libgfortran/generated/product_i2.c +++ b/libgfortran/generated/product_i2.c @@ -56,12 +56,15 @@ product_i2 (gfc_array_i2 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_i2 (gfc_array_i2 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_2 result; @@ -186,8 +190,8 @@ product_i2 (gfc_array_i2 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index 75028e57980..11132d4e2bb 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -56,12 +56,15 @@ product_i4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_i4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_4 result; @@ -186,8 +190,8 @@ product_i4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index 1fc446cf2a0..da28568f39e 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -56,12 +56,15 @@ product_i8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_i8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_8 result; @@ -186,8 +190,8 @@ product_i8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index 7956b30958d..fb0074e2226 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -56,12 +56,15 @@ product_r10 (gfc_array_r10 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_r10 (gfc_array_r10 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_REAL_10 result; @@ -186,8 +190,8 @@ product_r10 (gfc_array_r10 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index 9cfd8df0213..2375cbefef5 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -56,12 +56,15 @@ product_r16 (gfc_array_r16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_r16 (gfc_array_r16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_REAL_16 result; @@ -186,8 +190,8 @@ product_r16 (gfc_array_r16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index 276d91ae3fd..1a3aacc3b79 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -56,12 +56,15 @@ product_r4 (gfc_array_r4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_r4 (gfc_array_r4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_REAL_4 result; @@ -186,8 +190,8 @@ product_r4 (gfc_array_r4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index 2c07381736a..76cb1bedbbf 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -56,12 +56,15 @@ product_r8 (gfc_array_r8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ product_r8 (gfc_array_r8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_REAL_8 result; @@ -186,8 +190,8 @@ product_r8 (gfc_array_r8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index 6c222891753..0c53b6c5880 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -56,12 +56,15 @@ sum_c10 (gfc_array_c10 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_c10 (gfc_array_c10 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_10 * restrict src; GFC_COMPLEX_10 result; @@ -186,8 +190,8 @@ sum_c10 (gfc_array_c10 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index 203c483619a..a3db7aa7d2a 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -56,12 +56,15 @@ sum_c16 (gfc_array_c16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_c16 (gfc_array_c16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_16 * restrict src; GFC_COMPLEX_16 result; @@ -186,8 +190,8 @@ sum_c16 (gfc_array_c16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index 4a91bb2631a..849ab8a21ba 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -56,12 +56,15 @@ sum_c4 (gfc_array_c4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_c4 (gfc_array_c4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_4 * restrict src; GFC_COMPLEX_4 result; @@ -186,8 +190,8 @@ sum_c4 (gfc_array_c4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index f877d094135..dcdcadfcda9 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -56,12 +56,15 @@ sum_c8 (gfc_array_c8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_c8 (gfc_array_c8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_COMPLEX_8 * restrict src; GFC_COMPLEX_8 result; @@ -186,8 +190,8 @@ sum_c8 (gfc_array_c8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c index de46086a775..7b396818b53 100644 --- a/libgfortran/generated/sum_i1.c +++ b/libgfortran/generated/sum_i1.c @@ -56,12 +56,15 @@ sum_i1 (gfc_array_i1 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_i1 (gfc_array_i1 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_1 * restrict src; GFC_INTEGER_1 result; @@ -186,8 +190,8 @@ sum_i1 (gfc_array_i1 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index b7fc6e1a170..e99da269b81 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -56,12 +56,15 @@ sum_i16 (gfc_array_i16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_i16 (gfc_array_i16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_16 * restrict src; GFC_INTEGER_16 result; @@ -186,8 +190,8 @@ sum_i16 (gfc_array_i16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c index f7b85d7b6c8..8a61191a8f9 100644 --- a/libgfortran/generated/sum_i2.c +++ b/libgfortran/generated/sum_i2.c @@ -56,12 +56,15 @@ sum_i2 (gfc_array_i2 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_i2 (gfc_array_i2 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_2 * restrict src; GFC_INTEGER_2 result; @@ -186,8 +190,8 @@ sum_i2 (gfc_array_i2 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index 04849b5bcf1..f7912ff7aa4 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -56,12 +56,15 @@ sum_i4 (gfc_array_i4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_i4 (gfc_array_i4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_4 * restrict src; GFC_INTEGER_4 result; @@ -186,8 +190,8 @@ sum_i4 (gfc_array_i4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index bf65615376b..a8ad4a5a9af 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -56,12 +56,15 @@ sum_i8 (gfc_array_i8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_i8 (gfc_array_i8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_INTEGER_8 * restrict src; GFC_INTEGER_8 result; @@ -186,8 +190,8 @@ sum_i8 (gfc_array_i8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index deefd30870a..f96c72cc70b 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -56,12 +56,15 @@ sum_r10 (gfc_array_r10 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_r10 (gfc_array_r10 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_10 * restrict src; GFC_REAL_10 result; @@ -186,8 +190,8 @@ sum_r10 (gfc_array_r10 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index ee365f74d15..dd8bdcf4dc0 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -56,12 +56,15 @@ sum_r16 (gfc_array_r16 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_r16 (gfc_array_r16 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_16 * restrict src; GFC_REAL_16 result; @@ -186,8 +190,8 @@ sum_r16 (gfc_array_r16 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index 07f43397b7b..3a39c27f88e 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -56,12 +56,15 @@ sum_r4 (gfc_array_r4 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_r4 (gfc_array_r4 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_4 * restrict src; GFC_REAL_4 result; @@ -186,8 +190,8 @@ sum_r4 (gfc_array_r4 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index f83c683347d..858174ab430 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -56,12 +56,15 @@ sum_r8 (gfc_array_r8 * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -148,7 +151,8 @@ sum_r8 (gfc_array_r8 * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_REAL_8 * restrict src; GFC_REAL_8 result; @@ -186,8 +190,8 @@ sum_r8 (gfc_array_r8 * const restrict retarray, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index 5ab2952a491..edf3c77d05c 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -39,12 +39,15 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -131,7 +134,8 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const atype_name * restrict src; rtype_name result; @@ -169,8 +173,8 @@ define(FINISH_ARRAY_FUNCTION, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4 index 8666870c88e..a31d73a17b9 100644 --- a/libgfortran/m4/ifunction_logical.m4 +++ b/libgfortran/m4/ifunction_logical.m4 @@ -40,6 +40,7 @@ name`'rtype_qual`_'atype_code (rtype * 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; @@ -48,6 +49,9 @@ name`'rtype_qual`_'atype_code (rtype * 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++) @@ -147,7 +151,8 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; rtype_name result; @@ -185,7 +190,7 @@ define(FINISH_ARRAY_FUNCTION, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else |