summaryrefslogtreecommitdiffstats
path: root/libgfortran/generated/maxloc1_4_r8.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/generated/maxloc1_4_r8.c')
-rw-r--r--libgfortran/generated/maxloc1_4_r8.c68
1 files changed, 61 insertions, 7 deletions
diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c
index baae300a03b..822680a4941 100644
--- a/libgfortran/generated/maxloc1_4_r8.c
+++ b/libgfortran/generated/maxloc1_4_r8.c
@@ -116,7 +116,25 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
else
{
if (rank != GFC_DESCRIPTOR_RANK (retarray))
- runtime_error ("rank of return array incorrect");
+ runtime_error ("rank of return array incorrect in"
+ " MAXLOC intrinsic: is %d, should be %d",
+ GFC_DESCRIPTOR_RANK (retarray), rank);
+
+ if (compile_options.bounds_check)
+ {
+ for (n=0; n < rank; n++)
+ {
+ index_type ret_extent;
+
+ ret_extent = retarray->dim[n].ubound + 1
+ - retarray->dim[n].lbound;
+ if (extent[n] != ret_extent)
+ runtime_error ("Incorrect extent in return value of"
+ " MAXLOC intrinsic in dimension %d:"
+ " is %ld, should be %ld", n + 1,
+ (long int) ret_extent, (long int) extent[n]);
+ }
+ }
}
for (n = 0; n < rank; n++)
@@ -293,7 +311,35 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
else
{
if (rank != GFC_DESCRIPTOR_RANK (retarray))
- runtime_error ("rank of return array incorrect");
+ runtime_error ("rank of return array incorrect in MAXLOC intrinsic");
+
+ if (compile_options.bounds_check)
+ {
+ for (n=0; n < rank; n++)
+ {
+ index_type ret_extent;
+
+ ret_extent = retarray->dim[n].ubound + 1
+ - retarray->dim[n].lbound;
+ if (extent[n] != ret_extent)
+ runtime_error ("Incorrect extent in return value of"
+ " MAXLOC intrinsic in dimension %d:"
+ " is %ld, should be %ld", n + 1,
+ (long int) ret_extent, (long int) extent[n]);
+ }
+ for (n=0; n<= rank; n++)
+ {
+ index_type mask_extent, array_extent;
+
+ array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound;
+ if (array_extent != mask_extent)
+ runtime_error ("Incorrect extent in MASK argument of"
+ " MAXLOC intrinsic in dimension %d:"
+ " is %ld, should be %ld", n + 1,
+ (long int) mask_extent, (long int) array_extent);
+ }
+ }
}
for (n = 0; n < rank; n++)
@@ -406,13 +452,21 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
}
else
{
- if (GFC_DESCRIPTOR_RANK (retarray) != 1)
- runtime_error ("rank of return array does not equal 1");
+ if (compile_options.bounds_check)
+ {
+ int ret_rank;
+ index_type ret_extent;
- if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
- runtime_error ("dimension of return array incorrect");
- }
+ ret_rank = GFC_DESCRIPTOR_RANK (retarray);
+ if (ret_rank != 1)
+ runtime_error ("rank of return array in MAXLOC intrinsic"
+ " should be 1, is %d", ret_rank);
+ ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ if (ret_extent != rank)
+ runtime_error ("dimension of return array incorrect");
+ }
+ }
dstride = retarray->dim[0].stride;
dest = retarray->data;
OpenPOWER on IntegriCloud