diff options
Diffstat (limited to 'libgfortran/generated')
22 files changed, 473 insertions, 0 deletions
diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index ed54f1b637e..567d5b40283 100644 --- a/libgfortran/generated/reshape_c10.c +++ b/libgfortran/generated/reshape_c10.c @@ -121,6 +121,27 @@ reshape_c10 (gfc_array_c10 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index 636150933a0..79745f2de58 100644 --- a/libgfortran/generated/reshape_c16.c +++ b/libgfortran/generated/reshape_c16.c @@ -121,6 +121,27 @@ reshape_c16 (gfc_array_c16 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index 869d6231239..90383adf922 100644 --- a/libgfortran/generated/reshape_c4.c +++ b/libgfortran/generated/reshape_c4.c @@ -121,6 +121,27 @@ reshape_c4 (gfc_array_c4 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index 24ec469bcab..49178e5e09a 100644 --- a/libgfortran/generated/reshape_c8.c +++ b/libgfortran/generated/reshape_c8.c @@ -121,6 +121,27 @@ reshape_c8 (gfc_array_c8 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index e857b6b6a24..a6264651365 100644 --- a/libgfortran/generated/reshape_i16.c +++ b/libgfortran/generated/reshape_i16.c @@ -121,6 +121,27 @@ reshape_16 (gfc_array_i16 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 517d25d8703..1d3aa49e947 100644 --- a/libgfortran/generated/reshape_i4.c +++ b/libgfortran/generated/reshape_i4.c @@ -121,6 +121,27 @@ reshape_4 (gfc_array_i4 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index 75ba3197f34..8c51795f1ff 100644 --- a/libgfortran/generated/reshape_i8.c +++ b/libgfortran/generated/reshape_i8.c @@ -121,6 +121,27 @@ reshape_8 (gfc_array_i8 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index 2987ef7a58c..846d12f1f08 100644 --- a/libgfortran/generated/reshape_r10.c +++ b/libgfortran/generated/reshape_r10.c @@ -121,6 +121,27 @@ reshape_r10 (gfc_array_r10 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index 2d84b2b8672..286e374ff18 100644 --- a/libgfortran/generated/reshape_r16.c +++ b/libgfortran/generated/reshape_r16.c @@ -121,6 +121,27 @@ reshape_r16 (gfc_array_r16 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index fa68f826dac..cd16b24a9eb 100644 --- a/libgfortran/generated/reshape_r4.c +++ b/libgfortran/generated/reshape_r4.c @@ -121,6 +121,27 @@ reshape_r4 (gfc_array_r4 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index 8af57393439..9da26d4c199 100644 --- a/libgfortran/generated/reshape_r8.c +++ b/libgfortran/generated/reshape_r8.c @@ -121,6 +121,27 @@ reshape_r8 (gfc_array_r8 * const restrict ret, if (unlikely (compile_options.bounds_check)) { + index_type ret_extent, source_extent; + + rs = 1; + for (n = 0; n < rdim; n++) + { + rs *= shape_data[n]; + ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + if (ret_extent != shape_data[n]) + runtime_error("Incorrect extent in return value of RESHAPE" + " intrinsic in dimension %ld: is %ld," + " should be %ld", (long int) n+1, + (long int) ret_extent, (long int) shape_data[n]); + } + + source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (rs != source_extent) + runtime_error("Incorrect size in SOURCE argument to RESHAPE" + " intrinsic: is %ld, should be %ld", + (long int) source_extent, (long int) rs); + if (order) { int seen[GFC_MAX_DIMENSIONS]; diff --git a/libgfortran/generated/transpose_c10.c b/libgfortran/generated/transpose_c10.c index 72235967b34..65760e28051 100644 --- a/libgfortran/generated/transpose_c10.c +++ b/libgfortran/generated/transpose_c10.c @@ -69,6 +69,28 @@ transpose_c10 (gfc_array_c10 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_c16.c b/libgfortran/generated/transpose_c16.c index e3863f1f2ad..94b5b96e3f1 100644 --- a/libgfortran/generated/transpose_c16.c +++ b/libgfortran/generated/transpose_c16.c @@ -69,6 +69,28 @@ transpose_c16 (gfc_array_c16 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_c4.c b/libgfortran/generated/transpose_c4.c index cdb5a9a06e1..14cc7cadc62 100644 --- a/libgfortran/generated/transpose_c4.c +++ b/libgfortran/generated/transpose_c4.c @@ -69,6 +69,28 @@ transpose_c4 (gfc_array_c4 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_c8.c b/libgfortran/generated/transpose_c8.c index 91fb1042499..219331ba5f7 100644 --- a/libgfortran/generated/transpose_c8.c +++ b/libgfortran/generated/transpose_c8.c @@ -69,6 +69,28 @@ transpose_c8 (gfc_array_c8 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_i16.c b/libgfortran/generated/transpose_i16.c index b7564ad17aa..83d6257b3e2 100644 --- a/libgfortran/generated/transpose_i16.c +++ b/libgfortran/generated/transpose_i16.c @@ -69,6 +69,28 @@ transpose_i16 (gfc_array_i16 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_i4.c b/libgfortran/generated/transpose_i4.c index 51472fd09a0..f2a79cd02da 100644 --- a/libgfortran/generated/transpose_i4.c +++ b/libgfortran/generated/transpose_i4.c @@ -69,6 +69,28 @@ transpose_i4 (gfc_array_i4 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_i8.c b/libgfortran/generated/transpose_i8.c index 37428ddacbd..8c065de9029 100644 --- a/libgfortran/generated/transpose_i8.c +++ b/libgfortran/generated/transpose_i8.c @@ -69,6 +69,28 @@ transpose_i8 (gfc_array_i8 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_r10.c b/libgfortran/generated/transpose_r10.c index 32704166b1d..189e0dd726d 100644 --- a/libgfortran/generated/transpose_r10.c +++ b/libgfortran/generated/transpose_r10.c @@ -69,6 +69,28 @@ transpose_r10 (gfc_array_r10 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_REAL_10) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_r16.c b/libgfortran/generated/transpose_r16.c index 858b3a56555..928b1835533 100644 --- a/libgfortran/generated/transpose_r16.c +++ b/libgfortran/generated/transpose_r16.c @@ -69,6 +69,28 @@ transpose_r16 (gfc_array_r16 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_REAL_16) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_r4.c b/libgfortran/generated/transpose_r4.c index 1968302dd35..0cb2404b7bd 100644 --- a/libgfortran/generated/transpose_r4.c +++ b/libgfortran/generated/transpose_r4.c @@ -69,6 +69,28 @@ transpose_r4 (gfc_array_r4 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_REAL_4) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; diff --git a/libgfortran/generated/transpose_r8.c b/libgfortran/generated/transpose_r8.c index bbd87649126..78ae4a1a95a 100644 --- a/libgfortran/generated/transpose_r8.c +++ b/libgfortran/generated/transpose_r8.c @@ -69,6 +69,28 @@ transpose_r8 (gfc_array_r8 * const restrict ret, ret->data = internal_malloc_size (sizeof (GFC_REAL_8) * size0 ((array_t *) ret)); ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { + index_type ret_extent, src_extent; + + ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 1: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + + ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; + src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + + if (src_extent != ret_extent) + runtime_error ("Incorrect extent in return value of TRANSPOSE" + " intrinsic in dimension 2: is %ld," + " should be %ld", (long int) src_extent, + (long int) ret_extent); + } sxstride = source->dim[0].stride; |