diff options
118 files changed, 976 insertions, 329 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9bf58a9..11fb08c 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 0000000..a27c220 --- /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 ec9ab88..9da45d5 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 385726a..8345adc 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 fd6a9f0..ee6f8f9 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 16b4ec9..dd069c5 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 ef8bdcd..00a0896 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 8e7a659..b08c19c 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 8975438..2d11eb1 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 060a4b8..3d7cd1b 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 73db5ae..1c87418 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 3e239ca..71a8cb0 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 3ea80dd..55ff7a6 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 654c549..638fb17 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 ab2d0ea..52ae34b 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 bb29d4f..ddede71 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 82926bd..6bdc9ca 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 9cb094f..3c1c565 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 6e4153c..7ccceda 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 b4fd55d..d7126af 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 483b903..278ef5b 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 69d35d7..4e2e731 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 54d016c..1a9eb51 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 10ea868..79805f5 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 54b2aeb..49b27c3 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 f9712e6..cb4cc17 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 1e83628..bddedbe 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 271ef38..3a1ae07 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 627e360..d9e1b3e 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 cf42ddf..dedb28b 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 a26180f..12bad84 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 40f2c36..2215521 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 7549702..0ed1df2 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 3ed0d96..ae1a4f1 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 24ecf9a..6b16564 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 9a695da..bbc6f9e 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 489ed11..85c44f9 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 9f8c7ad..18d1ad1 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 28e0163..121cc0f 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 82038dc..8386a29 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 c7301ea..ed71c49 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 d83600d..a7b71bc 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 6d45297..9fd0b46 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 470d73c..79f1103 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 7003594..b0ab760 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 9468e4a..a7288eb 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 de2cac8..d50ab6f 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 818fc29..c49b181 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 e5289f1..354c86d 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 d05737d..91a2b00 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 921ad48..c959a80 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 15bdd7e..a05808d2 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 f3470e8..a00468b 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 b5d7f3c..1c9e41d 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 8a20d7b..f95aa90 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 f0c5b84..9a5da30 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 234f364..ad282f9 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 2b55cff..7eb382d 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 2e2e894..7995d26 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 dcf291f..c7da9d1 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 eb49613..c24cb81 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 dd39b5d..37cda9b 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 e31410f0..b0bbf82 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 5111c7d..eab1b40 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 db89832..3446e4e 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 3e1448d..1e2a8c6 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 b66c23e..6e4b137 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 1eb3c4c..5295a10 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 a224fd3..a020a99 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 404be41..19bf03c 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 4d9844c..ba54897 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 fc9b0ae..07fb27a 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 b0fbe0d..409a961a 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 4c4a76c..47fc666 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 f18cd2a..22080173 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 758249e..71df4e6 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 245522e..d4e471a 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 ae8035e..6163239 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 af4e2ea..3e0416a 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 3f2b2e1..c6a6ad4 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 5e00272..8a01e3e 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 3815d44..719a049 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 b8b99d3..c4f699b 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 1e83efd..2ff292f 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 a40fc2c..96bfe32 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 af37f43..1682dd2 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 829c630..fa9e636 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 c3797c7..9561caa 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 c8c8fd5..ac048ee 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 e404b17..21ecb3c 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 0366544..66a9c05 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 c4612cf..ec2acb4 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 53c7f80..bd52eb9 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 812fb3b..c124355 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 72b894f..362a08a 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 e042931..a687c3a 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 af3da57..f8082b4 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 75028e5..11132d4 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 1fc446c..da28568 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 7956b30..fb0074e 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 9cfd8df..2375cbe 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 276d91a..1a3aacc 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 2c07381..76cb1be 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 6c22289..0c53b6c 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 203c483..a3db7aa 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 4a91bb2..849ab8a 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 f877d09..dcdcadf 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 de46086..7b39681 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 b7fc6e1..e99da26 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 f7b85d7..8a61191 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 04849b5..f7912ff 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 bf65615..a8ad4a5 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 deefd30..f96c72c 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 ee365f7..dd8bdcf 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 07f4339..3a39c27 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 f83c683..858174a 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 5ab2952..edf3c77 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 8666870..a31d73a 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 |