https://gcc.gnu.org/g:ec78005ac807a5c945f2ed676d041cff1bdcb539
commit ec78005ac807a5c945f2ed676d041cff1bdcb539 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Wed May 14 19:09:09 2025 +0200 Correction régression findloc_2 Diff: --- libgfortran/generated/findloc0_c10.c | 19 ++++++++++--------- libgfortran/generated/findloc0_c16.c | 19 ++++++++++--------- libgfortran/generated/findloc0_c17.c | 19 ++++++++++--------- libgfortran/generated/findloc0_c4.c | 19 ++++++++++--------- libgfortran/generated/findloc0_c8.c | 19 ++++++++++--------- libgfortran/generated/findloc0_i1.c | 19 ++++++++++--------- libgfortran/generated/findloc0_i16.c | 19 ++++++++++--------- libgfortran/generated/findloc0_i2.c | 19 ++++++++++--------- libgfortran/generated/findloc0_i4.c | 19 ++++++++++--------- libgfortran/generated/findloc0_i8.c | 19 ++++++++++--------- libgfortran/generated/findloc0_r10.c | 19 ++++++++++--------- libgfortran/generated/findloc0_r16.c | 19 ++++++++++--------- libgfortran/generated/findloc0_r17.c | 19 ++++++++++--------- libgfortran/generated/findloc0_r4.c | 19 ++++++++++--------- libgfortran/generated/findloc0_r8.c | 19 ++++++++++--------- libgfortran/generated/findloc0_s1.c | 19 ++++++++++--------- libgfortran/generated/findloc0_s4.c | 19 ++++++++++--------- libgfortran/m4/ifindloc0.m4 | 19 ++++++++++--------- 18 files changed, 180 insertions(+), 162 deletions(-) diff --git a/libgfortran/generated/findloc0_c10.c b/libgfortran/generated/findloc0_c10.c index 009e3be8e1b8..ee8a08e225cf 100644 --- a/libgfortran/generated/findloc0_c10.c +++ b/libgfortran/generated/findloc0_c10.c @@ -44,7 +44,6 @@ findloc0_c10 (gfc_array_index_type * const restrict retarray, const GFC_COMPLEX_10 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_c10 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_10); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_c10 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_10*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_COMPLEX_10*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_c10 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_c10 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_10); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_c10 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_10*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_COMPLEX_10*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_c16.c b/libgfortran/generated/findloc0_c16.c index 5a25740c0e71..f9e07a127165 100644 --- a/libgfortran/generated/findloc0_c16.c +++ b/libgfortran/generated/findloc0_c16.c @@ -44,7 +44,6 @@ findloc0_c16 (gfc_array_index_type * const restrict retarray, const GFC_COMPLEX_16 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_c16 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_16); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_c16 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_16*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_COMPLEX_16*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_c16 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_c16 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_16); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_c16 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_16*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_COMPLEX_16*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_c17.c b/libgfortran/generated/findloc0_c17.c index 0b04e770e9c9..fa77f113b31e 100644 --- a/libgfortran/generated/findloc0_c17.c +++ b/libgfortran/generated/findloc0_c17.c @@ -44,7 +44,6 @@ findloc0_c17 (gfc_array_index_type * const restrict retarray, const GFC_COMPLEX_17 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_c17 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_17); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_c17 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_17*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_COMPLEX_17*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_c17 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_c17 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_17); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_c17 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_17*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_COMPLEX_17*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_c4.c b/libgfortran/generated/findloc0_c4.c index 95051ea310da..f9ac7062a185 100644 --- a/libgfortran/generated/findloc0_c4.c +++ b/libgfortran/generated/findloc0_c4.c @@ -44,7 +44,6 @@ findloc0_c4 (gfc_array_index_type * const restrict retarray, const GFC_COMPLEX_4 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_c4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_c4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_4*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_COMPLEX_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_c4 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_c4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_c4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_4*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_COMPLEX_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_c8.c b/libgfortran/generated/findloc0_c8.c index 734b14f709ab..2117c488e4b1 100644 --- a/libgfortran/generated/findloc0_c8.c +++ b/libgfortran/generated/findloc0_c8.c @@ -44,7 +44,6 @@ findloc0_c8 (gfc_array_index_type * const restrict retarray, const GFC_COMPLEX_8 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_c8 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_8); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_c8 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_8*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_COMPLEX_8*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_c8 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_c8 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_COMPLEX_8); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_c8 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_COMPLEX_8*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_COMPLEX_8*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_i1.c b/libgfortran/generated/findloc0_i1.c index 22d80cfb3017..e9fc4368292e 100644 --- a/libgfortran/generated/findloc0_i1.c +++ b/libgfortran/generated/findloc0_i1.c @@ -44,7 +44,6 @@ findloc0_i1 (gfc_array_index_type * const restrict retarray, const GFC_INTEGER_1 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_i1 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_1); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_i1 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_1*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_INTEGER_1*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_i1 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_i1 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_1); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_i1 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_1*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_INTEGER_1*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_i16.c b/libgfortran/generated/findloc0_i16.c index 895dfd4cabb4..b06cdf6439bb 100644 --- a/libgfortran/generated/findloc0_i16.c +++ b/libgfortran/generated/findloc0_i16.c @@ -44,7 +44,6 @@ findloc0_i16 (gfc_array_index_type * const restrict retarray, const GFC_INTEGER_16 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_i16 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_16); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_i16 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_16*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_INTEGER_16*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_i16 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_i16 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_16); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_i16 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_16*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_INTEGER_16*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_i2.c b/libgfortran/generated/findloc0_i2.c index 2b30ca123f19..f98350c6e97b 100644 --- a/libgfortran/generated/findloc0_i2.c +++ b/libgfortran/generated/findloc0_i2.c @@ -44,7 +44,6 @@ findloc0_i2 (gfc_array_index_type * const restrict retarray, const GFC_INTEGER_2 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_i2 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_2); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_i2 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_2*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_INTEGER_2*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_i2 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_i2 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_2); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_i2 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_2*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_INTEGER_2*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_i4.c b/libgfortran/generated/findloc0_i4.c index f433c1f5e3f2..fdfbd98636ec 100644 --- a/libgfortran/generated/findloc0_i4.c +++ b/libgfortran/generated/findloc0_i4.c @@ -44,7 +44,6 @@ findloc0_i4 (gfc_array_index_type * const restrict retarray, const GFC_INTEGER_4 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_i4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_i4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_4*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_INTEGER_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_i4 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_i4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_i4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_4*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_INTEGER_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_i8.c b/libgfortran/generated/findloc0_i8.c index 39e5777997b2..228b4ecd5942 100644 --- a/libgfortran/generated/findloc0_i8.c +++ b/libgfortran/generated/findloc0_i8.c @@ -44,7 +44,6 @@ findloc0_i8 (gfc_array_index_type * const restrict retarray, const GFC_INTEGER_8 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_i8 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_8); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_i8 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_8*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_INTEGER_8*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_i8 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_i8 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_INTEGER_8); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_i8 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_INTEGER_8*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_INTEGER_8*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_r10.c b/libgfortran/generated/findloc0_r10.c index abad1310de28..8432265f5b29 100644 --- a/libgfortran/generated/findloc0_r10.c +++ b/libgfortran/generated/findloc0_r10.c @@ -44,7 +44,6 @@ findloc0_r10 (gfc_array_index_type * const restrict retarray, const GFC_REAL_10 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_r10 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_10); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_r10 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_10*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_REAL_10*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_r10 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_r10 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_10); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_r10 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_10*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_REAL_10*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_r16.c b/libgfortran/generated/findloc0_r16.c index db76fcf4e314..39408dd05976 100644 --- a/libgfortran/generated/findloc0_r16.c +++ b/libgfortran/generated/findloc0_r16.c @@ -44,7 +44,6 @@ findloc0_r16 (gfc_array_index_type * const restrict retarray, const GFC_REAL_16 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_r16 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_16); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_r16 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_16*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_REAL_16*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_r16 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_r16 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_16); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_r16 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_16*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_REAL_16*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_r17.c b/libgfortran/generated/findloc0_r17.c index 895f5bf7406e..731a3d029b6d 100644 --- a/libgfortran/generated/findloc0_r17.c +++ b/libgfortran/generated/findloc0_r17.c @@ -44,7 +44,6 @@ findloc0_r17 (gfc_array_index_type * const restrict retarray, const GFC_REAL_17 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_r17 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_17); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_r17 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_17*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_REAL_17*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_r17 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_r17 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_17); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_r17 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_17*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_REAL_17*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_r4.c b/libgfortran/generated/findloc0_r4.c index 308a10f4a79e..2e0d6a8f0346 100644 --- a/libgfortran/generated/findloc0_r4.c +++ b/libgfortran/generated/findloc0_r4.c @@ -44,7 +44,6 @@ findloc0_r4 (gfc_array_index_type * const restrict retarray, const GFC_REAL_4 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_r4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_r4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_4*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_REAL_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_r4 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_r4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_r4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_4*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_REAL_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_r8.c b/libgfortran/generated/findloc0_r8.c index dd416b7f7342..a650d21a3758 100644 --- a/libgfortran/generated/findloc0_r8.c +++ b/libgfortran/generated/findloc0_r8.c @@ -44,7 +44,6 @@ findloc0_r8 (gfc_array_index_type * const restrict retarray, const GFC_REAL_8 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -68,12 +67,10 @@ findloc0_r8 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_8); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -83,7 +80,9 @@ findloc0_r8 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_8*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_REAL_8*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -178,7 +177,6 @@ mfindloc0_r8 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -219,13 +217,11 @@ mfindloc0_r8 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_REAL_8); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -235,8 +231,13 @@ mfindloc0_r8 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_REAL_8*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_REAL_8*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_s1.c b/libgfortran/generated/findloc0_s1.c index deff0393fecf..8acc9edfd52f 100644 --- a/libgfortran/generated/findloc0_s1.c +++ b/libgfortran/generated/findloc0_s1.c @@ -45,7 +45,6 @@ findloc0_s1 (gfc_array_index_type * const restrict retarray, const GFC_UINTEGER_1 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -69,12 +68,10 @@ findloc0_s1 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_UINTEGER_1); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -84,7 +81,9 @@ findloc0_s1 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_UINTEGER_1*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_UINTEGER_1*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -181,7 +180,6 @@ mfindloc0_s1 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -222,13 +220,11 @@ mfindloc0_s1 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_UINTEGER_1); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -238,8 +234,13 @@ mfindloc0_s1 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_UINTEGER_1*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_UINTEGER_1*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/generated/findloc0_s4.c b/libgfortran/generated/findloc0_s4.c index 5f1b9c6673b1..520ee21e3f65 100644 --- a/libgfortran/generated/findloc0_s4.c +++ b/libgfortran/generated/findloc0_s4.c @@ -45,7 +45,6 @@ findloc0_s4 (gfc_array_index_type * const restrict retarray, const GFC_UINTEGER_4 *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -69,12 +68,10 @@ findloc0_s4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_UINTEGER_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -84,7 +81,9 @@ findloc0_s4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_UINTEGER_4*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = (GFC_UINTEGER_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -181,7 +180,6 @@ mfindloc0_s4 (gfc_array_index_type * const restrict retarray, index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -222,13 +220,11 @@ mfindloc0_s4 (gfc_array_index_type * const restrict retarray, for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof (GFC_UINTEGER_4); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -238,8 +234,13 @@ mfindloc0_s4 (gfc_array_index_type * const restrict retarray, if (back) { - base = (GFC_UINTEGER_4*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = (GFC_UINTEGER_4*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do diff --git a/libgfortran/m4/ifindloc0.m4 b/libgfortran/m4/ifindloc0.m4 index 3f6e94a7e9f5..fb98e25a7d7f 100644 --- a/libgfortran/m4/ifindloc0.m4 +++ b/libgfortran/m4/ifindloc0.m4 @@ -35,7 +35,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see const 'atype_name` *base; index_type rank; index_type n; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -59,12 +58,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof ('atype_name`); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -74,7 +71,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see if (back) { - base = ('atype_name`*) (((char*)array->base_addr) + (sz - 1)); + base = array->base_addr; + for (n = 0; n < rank; n++) + base = ('atype_name`*) (((char*)base) + (extent[n] - 1) * sspacing[n]); while (1) { @@ -161,7 +160,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see index_type rank; index_type n; int mask_kind; - index_type sz; rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) @@ -202,13 +200,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see for (n = 0; n < rank; n++) GFC_DESCRIPTOR1_ELEM (index_type, retarray, n) = 0; - sz = sizeof ('atype_name`); for (n = 0; n < rank; n++) { sspacing[n] = GFC_DESCRIPTOR_SPACING(array,n); mspacing[n] = GFC_DESCRIPTOR_SPACING(mask,n); extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); - sz *= extent[n]; if (extent[n] <= 0) return; } @@ -218,8 +214,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see if (back) { - base = ('atype_name`*) (((char*)array->base_addr) + (sz - 1)); - mbase = mbase + (sz - 1) * mask_kind; + base = array->base_addr; + for (n = 0; n < rank; n++) + { + base = ('atype_name`*) (((char*)base) + (extent[n] - 1) * sspacing[n]); + mbase = mbase + (extent[n] - 1) * mspacing[n]; + } + while (1) { do