diff options
Diffstat (limited to 'libgfortran/generated')
-rw-r--r-- | libgfortran/generated/pack_c10.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_c16.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_c4.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_c8.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_i1.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_i16.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_i2.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_i4.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_i8.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_r10.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_r16.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_r4.c | 12 | ||||
-rw-r--r-- | libgfortran/generated/pack_r8.c | 12 |
13 files changed, 143 insertions, 13 deletions
diff --git a/libgfortran/generated/pack_c10.c b/libgfortran/generated/pack_c10.c index c9a0c58a5b5..0bad32385d8 100644 --- a/libgfortran/generated/pack_c10.c +++ b/libgfortran/generated/pack_c10.c @@ -103,7 +103,6 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, } #endif + diff --git a/libgfortran/generated/pack_c16.c b/libgfortran/generated/pack_c16.c index 2996be2d220..a0c87ec8a26 100644 --- a/libgfortran/generated/pack_c16.c +++ b/libgfortran/generated/pack_c16.c @@ -103,7 +103,6 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, } #endif + diff --git a/libgfortran/generated/pack_c4.c b/libgfortran/generated/pack_c4.c index ee41c0b8cbf..2fb6a20ad9c 100644 --- a/libgfortran/generated/pack_c4.c +++ b/libgfortran/generated/pack_c4.c @@ -103,7 +103,6 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, } #endif + diff --git a/libgfortran/generated/pack_c8.c b/libgfortran/generated/pack_c8.c index a129422e04f..1a4e78ec792 100644 --- a/libgfortran/generated/pack_c8.c +++ b/libgfortran/generated/pack_c8.c @@ -103,7 +103,6 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, } #endif + diff --git a/libgfortran/generated/pack_i1.c b/libgfortran/generated/pack_i1.c index 25d7f569de5..44c6c677e44 100644 --- a/libgfortran/generated/pack_i1.c +++ b/libgfortran/generated/pack_i1.c @@ -103,7 +103,6 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, } #endif + diff --git a/libgfortran/generated/pack_i16.c b/libgfortran/generated/pack_i16.c index 35c64ce8a9e..e9c15437977 100644 --- a/libgfortran/generated/pack_i16.c +++ b/libgfortran/generated/pack_i16.c @@ -103,7 +103,6 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, } #endif + diff --git a/libgfortran/generated/pack_i2.c b/libgfortran/generated/pack_i2.c index 3a42bd38d78..51380c26ba7 100644 --- a/libgfortran/generated/pack_i2.c +++ b/libgfortran/generated/pack_i2.c @@ -103,7 +103,6 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, } #endif + diff --git a/libgfortran/generated/pack_i4.c b/libgfortran/generated/pack_i4.c index 28e09f6abec..861670d6865 100644 --- a/libgfortran/generated/pack_i4.c +++ b/libgfortran/generated/pack_i4.c @@ -103,7 +103,6 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, } #endif + diff --git a/libgfortran/generated/pack_i8.c b/libgfortran/generated/pack_i8.c index 44fc430782f..c547f3809f2 100644 --- a/libgfortran/generated/pack_i8.c +++ b/libgfortran/generated/pack_i8.c @@ -103,7 +103,6 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, } #endif + diff --git a/libgfortran/generated/pack_r10.c b/libgfortran/generated/pack_r10.c index 72fe254d918..4b8c5784aef 100644 --- a/libgfortran/generated/pack_r10.c +++ b/libgfortran/generated/pack_r10.c @@ -103,7 +103,6 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, } #endif + diff --git a/libgfortran/generated/pack_r16.c b/libgfortran/generated/pack_r16.c index 0ced53ab017..a691f7c4041 100644 --- a/libgfortran/generated/pack_r16.c +++ b/libgfortran/generated/pack_r16.c @@ -103,7 +103,6 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, } #endif + diff --git a/libgfortran/generated/pack_r4.c b/libgfortran/generated/pack_r4.c index 17172ed92a8..c008aadf4d4 100644 --- a/libgfortran/generated/pack_r4.c +++ b/libgfortran/generated/pack_r4.c @@ -103,7 +103,6 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, } #endif + diff --git a/libgfortran/generated/pack_r8.c b/libgfortran/generated/pack_r8.c index 9d0fb5b5d78..7b360479628 100644 --- a/libgfortran/generated/pack_r8.c +++ b/libgfortran/generated/pack_r8.c @@ -103,7 +103,6 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -139,6 +138,11 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -149,6 +153,11 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -308,3 +317,4 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, } #endif + |