From da96f5ab49d8e45bdca0d08c5ecc408ddbc3de47 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 4 May 2008 19:07:28 +0000 Subject: [PATCH] re PR fortran/35995 (ANY, ALL, and COUNT errors for zero sized sections) 2008-05-04 Thomas Koenig 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 PR libfortran/35995 * gfortran.dg/intrinsic_ifunction_1.f90: New test case. From-SVN: r134934 --- gcc/testsuite/ChangeLog | 5 + .../gfortran.dg/intrinsic_ifunction_1.f90 | 43 ++++++ libgfortran/ChangeLog | 123 ++++++++++++++++++ libgfortran/generated/all_l1.c | 9 +- libgfortran/generated/all_l16.c | 9 +- libgfortran/generated/all_l2.c | 9 +- libgfortran/generated/all_l4.c | 9 +- libgfortran/generated/all_l8.c | 9 +- libgfortran/generated/any_l1.c | 9 +- libgfortran/generated/any_l16.c | 9 +- libgfortran/generated/any_l2.c | 9 +- libgfortran/generated/any_l4.c | 9 +- libgfortran/generated/any_l8.c | 9 +- libgfortran/generated/count_16_l.c | 9 +- libgfortran/generated/count_1_l.c | 9 +- libgfortran/generated/count_2_l.c | 9 +- libgfortran/generated/count_4_l.c | 9 +- libgfortran/generated/count_8_l.c | 9 +- libgfortran/generated/maxloc1_16_i1.c | 10 +- libgfortran/generated/maxloc1_16_i16.c | 10 +- libgfortran/generated/maxloc1_16_i2.c | 10 +- libgfortran/generated/maxloc1_16_i4.c | 10 +- libgfortran/generated/maxloc1_16_i8.c | 10 +- libgfortran/generated/maxloc1_16_r10.c | 10 +- libgfortran/generated/maxloc1_16_r16.c | 10 +- libgfortran/generated/maxloc1_16_r4.c | 10 +- libgfortran/generated/maxloc1_16_r8.c | 10 +- libgfortran/generated/maxloc1_4_i1.c | 10 +- libgfortran/generated/maxloc1_4_i16.c | 10 +- libgfortran/generated/maxloc1_4_i2.c | 10 +- libgfortran/generated/maxloc1_4_i4.c | 10 +- libgfortran/generated/maxloc1_4_i8.c | 10 +- libgfortran/generated/maxloc1_4_r10.c | 10 +- libgfortran/generated/maxloc1_4_r16.c | 10 +- libgfortran/generated/maxloc1_4_r4.c | 10 +- libgfortran/generated/maxloc1_4_r8.c | 10 +- libgfortran/generated/maxloc1_8_i1.c | 10 +- libgfortran/generated/maxloc1_8_i16.c | 10 +- libgfortran/generated/maxloc1_8_i2.c | 10 +- libgfortran/generated/maxloc1_8_i4.c | 10 +- libgfortran/generated/maxloc1_8_i8.c | 10 +- libgfortran/generated/maxloc1_8_r10.c | 10 +- libgfortran/generated/maxloc1_8_r16.c | 10 +- libgfortran/generated/maxloc1_8_r4.c | 10 +- libgfortran/generated/maxloc1_8_r8.c | 10 +- libgfortran/generated/maxval_i1.c | 10 +- libgfortran/generated/maxval_i16.c | 10 +- libgfortran/generated/maxval_i2.c | 10 +- libgfortran/generated/maxval_i4.c | 10 +- libgfortran/generated/maxval_i8.c | 10 +- libgfortran/generated/maxval_r10.c | 10 +- libgfortran/generated/maxval_r16.c | 10 +- libgfortran/generated/maxval_r4.c | 10 +- libgfortran/generated/maxval_r8.c | 10 +- libgfortran/generated/minloc1_16_i1.c | 10 +- libgfortran/generated/minloc1_16_i16.c | 10 +- libgfortran/generated/minloc1_16_i2.c | 10 +- libgfortran/generated/minloc1_16_i4.c | 10 +- libgfortran/generated/minloc1_16_i8.c | 10 +- libgfortran/generated/minloc1_16_r10.c | 10 +- libgfortran/generated/minloc1_16_r16.c | 10 +- libgfortran/generated/minloc1_16_r4.c | 10 +- libgfortran/generated/minloc1_16_r8.c | 10 +- libgfortran/generated/minloc1_4_i1.c | 10 +- libgfortran/generated/minloc1_4_i16.c | 10 +- libgfortran/generated/minloc1_4_i2.c | 10 +- libgfortran/generated/minloc1_4_i4.c | 10 +- libgfortran/generated/minloc1_4_i8.c | 10 +- libgfortran/generated/minloc1_4_r10.c | 10 +- libgfortran/generated/minloc1_4_r16.c | 10 +- libgfortran/generated/minloc1_4_r4.c | 10 +- libgfortran/generated/minloc1_4_r8.c | 10 +- libgfortran/generated/minloc1_8_i1.c | 10 +- libgfortran/generated/minloc1_8_i16.c | 10 +- libgfortran/generated/minloc1_8_i2.c | 10 +- libgfortran/generated/minloc1_8_i4.c | 10 +- libgfortran/generated/minloc1_8_i8.c | 10 +- libgfortran/generated/minloc1_8_r10.c | 10 +- libgfortran/generated/minloc1_8_r16.c | 10 +- libgfortran/generated/minloc1_8_r4.c | 10 +- libgfortran/generated/minloc1_8_r8.c | 10 +- libgfortran/generated/minval_i1.c | 10 +- libgfortran/generated/minval_i16.c | 10 +- libgfortran/generated/minval_i2.c | 10 +- libgfortran/generated/minval_i4.c | 10 +- libgfortran/generated/minval_i8.c | 10 +- libgfortran/generated/minval_r10.c | 10 +- libgfortran/generated/minval_r16.c | 10 +- libgfortran/generated/minval_r4.c | 10 +- libgfortran/generated/minval_r8.c | 10 +- libgfortran/generated/product_c10.c | 10 +- libgfortran/generated/product_c16.c | 10 +- libgfortran/generated/product_c4.c | 10 +- libgfortran/generated/product_c8.c | 10 +- libgfortran/generated/product_i1.c | 10 +- libgfortran/generated/product_i16.c | 10 +- libgfortran/generated/product_i2.c | 10 +- libgfortran/generated/product_i4.c | 10 +- libgfortran/generated/product_i8.c | 10 +- libgfortran/generated/product_r10.c | 10 +- libgfortran/generated/product_r16.c | 10 +- libgfortran/generated/product_r4.c | 10 +- libgfortran/generated/product_r8.c | 10 +- libgfortran/generated/sum_c10.c | 10 +- libgfortran/generated/sum_c16.c | 10 +- libgfortran/generated/sum_c4.c | 10 +- libgfortran/generated/sum_c8.c | 10 +- libgfortran/generated/sum_i1.c | 10 +- libgfortran/generated/sum_i16.c | 10 +- libgfortran/generated/sum_i2.c | 10 +- libgfortran/generated/sum_i4.c | 10 +- libgfortran/generated/sum_i8.c | 10 +- libgfortran/generated/sum_r10.c | 10 +- libgfortran/generated/sum_r16.c | 10 +- libgfortran/generated/sum_r4.c | 10 +- libgfortran/generated/sum_r8.c | 10 +- libgfortran/m4/ifunction.m4 | 10 +- libgfortran/m4/ifunction_logical.m4 | 9 +- 118 files changed, 976 insertions(+), 329 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/intrinsic_ifunction_1.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9bf58a970a5e..11fb08ced85f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-04 Thomas Koenig + + PR libfortran/35995 + * gfortran.dg/intrinsic_ifunction_1.f90: New test case. + 2008-05-04 Andy Hutchinson * 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 000000000000..a27c220ee460 --- /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 ec9ab88b7533..9da45d503c5f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,126 @@ +2008-05-04 Thomas Koenig + + 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 PR libfortran/35990 diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c index 385726af3994..8345adc1f6e6 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 fd6a9f0b7156..ee6f8f93c9fb 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 16b4ec94ea1d..dd069c57d612 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 ef8bdcdddbae..00a0896f669f 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 8e7a659a2832..b08c19cdba57 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 8975438ae59b..2d11eb1a3b40 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 060a4b821277..3d7cd1b1ef9c 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 73db5aea082d..1c874182b3e2 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 3e239cab1068..71a8cb0e63fb 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 3ea80dd3e315..55ff7a601b0d 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 654c5495dec4..638fb179e251 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 ab2d0eac21ad..52ae34baa5f3 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 bb29d4f3c4f5..ddede7160f58 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 82926bd522ea..6bdc9ca18bf2 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 9cb094f81cd0..3c1c56536108 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 6e4153c3eb99..7cccedae55b7 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 b4fd55d63502..d7126afbcce0 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 483b90372eee..278ef5b5eb93 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 69d35d75556d..4e2e73114d3e 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 54d016c2d514..1a9eb519adbd 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 10ea86849e5c..79805f5519b1 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 54b2aeb90eb3..49b27c342274 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 f9712e6082ae..cb4cc17f78c5 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 1e8362884394..bddedbe63fa9 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 271ef38e3f23..3a1ae07de92c 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 627e36030c45..d9e1b3e527fa 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 cf42ddfc7082..dedb28b8dc07 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 a26180f4e7f4..12bad843e920 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 40f2c36a93d9..2215521cb1b6 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 75497022d760..0ed1df2fde03 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 3ed0d96671e4..ae1a4f16fabb 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 24ecf9a40e66..6b1656424cd7 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 9a695da2b298..bbc6f9e54e5d 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 489ed11a8fcd..85c44f9d0dcd 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 9f8c7ad01ffe..18d1ad1d2f20 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 28e016391989..121cc0fe8cb7 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 82038dc47457..8386a29979e9 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 c7301eab6c12..ed71c4925021 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 d83600d60199..a7b71bc54f3b 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 6d45297df772..9fd0b46dbda2 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 470d73c1ea3e..79f1103dc8f0 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 7003594e00cb..b0ab7608b41f 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 9468e4aad4a8..a7288eb827b4 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 de2cac8c1130..d50ab6f3558a 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 818fc29e8896..c49b18120431 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 e5289f1e1d82..354c86d9a1ed 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 d05737d66f1e..91a2b00c619f 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 921ad487d474..c959a8083a6a 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 15bdd7e215a3..a05808d2e5c5 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 f3470e8b951c..a00468bc8457 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 b5d7f3c0d521..1c9e41df6d09 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 8a20d7b453c5..f95aa9068979 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 f0c5b84384af..9a5da308ede9 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 234f364880ab..ad282f9b774a 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 2b55cff40b86..7eb382d89eed 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 2e2e89407c01..7995d26101ce 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 dcf291f64537..c7da9d1b5dc0 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 eb496134df7e..c24cb81dca5f 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 dd39b5dd02ce..37cda9b2c1cb 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 e31410f0cece..b0bbf82d313a 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 5111c7d6f460..eab1b40109df 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 db898320157d..3446e4e825db 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 3e1448dc50f2..1e2a8c6652db 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 b66c23edfc1e..6e4b137f183b 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 1eb3c4cbcf01..5295a1050c7c 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 a224fd3ef057..a020a9908a6c 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 404be416cff7..19bf03c3b75b 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 4d9844ce633b..ba54897ba391 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 fc9b0aea239d..07fb27a66065 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 b0fbe0d946ec..409a961a7866 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 4c4a76c75de0..47fc6665dec1 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 f18cd2aea79d..22080173f897 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 758249e06315..71df4e662e38 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 245522e579dc..d4e471a62bbb 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 ae8035ee0619..61632394d6cb 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 af4e2ea41b22..3e0416adb527 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 3f2b2e1dd4e7..c6a6ad4bc555 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 5e00272ec9bf..8a01e3edf26a 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 3815d44f8df0..719a0497c6c0 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 b8b99d33529f..c4f699b01b11 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 1e83efd024ca..2ff292fe9b14 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 a40fc2cfd77d..96bfe32bde6c 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 af37f4369af0..1682dd2fa394 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 829c630037bf..fa9e6366e380 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 c3797c7f537b..9561caa94da9 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 c8c8fd518090..ac048eedb064 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 e404b170b915..21ecb3c5afba 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 0366544a205f..66a9c05dec73 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 c4612cf2059d..ec2acb4e4f97 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 53c7f80b269c..bd52eb9ab771 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 812fb3ba38e6..c124355c1b2b 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 72b894f89c41..362a08ac6a1d 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 e04293179a84..a687c3a218e0 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 af3da57cf979..f8082b4c7bbf 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 75028e57980a..11132d4e2bb6 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 1fc446cf2a0d..da28568f39e6 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 7956b30958d7..fb0074e22269 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 9cfd8df0213a..2375cbefef5b 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 276d91ae3fde..1a3aacc3b791 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 2c07381736a8..76cb1bedbbf3 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 6c2228917533..0c53b6c58803 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 203c483619ae..a3db7aa7d2aa 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 4a91bb2631a6..849ab8a21bab 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 f877d0941353..dcdcadfcda96 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 de46086a7756..7b396818b53d 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 b7fc6e1a1704..e99da269b81c 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 f7b85d7b6c8d..8a61191a8f99 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 04849b5bcf18..f7912ff7aa44 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 bf65615376b6..a8ad4a5a9af7 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 deefd30870a6..f96c72cc70b9 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 ee365f74d15c..dd8bdcf4dc01 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 07f43397b7be..3a39c27f88ee 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 f83c683347dd..858174ab4307 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 5ab2952a4912..edf3c77d05cb 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 8666870c88e0..a31d73a17b93 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