summaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-20 05:35:17 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-20 05:35:17 +0000
commit6b351cc8c497c4ed9d296b55b424341f20b56f92 (patch)
tree8bcbc6cc30a2f9d6253007a662393cfed258713a /libgfortran/intrinsics
parentd0df232358778b869142e628e5e736fc7515f5ab (diff)
downloadgcc-6b351cc8c497c4ed9d296b55b424341f20b56f92.tar.gz
2009-07-20 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 149800 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@149801 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r--libgfortran/intrinsics/cshift0.c13
-rw-r--r--libgfortran/intrinsics/eoshift0.c19
-rw-r--r--libgfortran/intrinsics/eoshift2.c14
3 files changed, 32 insertions, 14 deletions
diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c
index 1b7dbc1cec9..6adea76da3a 100644
--- a/libgfortran/intrinsics/cshift0.c
+++ b/libgfortran/intrinsics/cshift0.c
@@ -87,14 +87,17 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
if (arraysize > 0)
ret->data = internal_malloc_size (size * arraysize);
else
- {
- ret->data = internal_malloc_size (1);
- return;
- }
+ ret->data = internal_malloc_size (1);
}
-
+ else if (unlikely (compile_options.bounds_check))
+ {
+ bounds_equal_extents ((array_t *) ret, (array_t *) array,
+ "return value", "CSHIFT");
+ }
+
if (arraysize == 0)
return;
+
type_size = GFC_DTYPE_TYPE_SIZE (array);
switch(type_size)
diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c
index 4b8082fdeca..74ba5ab7a97 100644
--- a/libgfortran/intrinsics/eoshift0.c
+++ b/libgfortran/intrinsics/eoshift0.c
@@ -54,6 +54,7 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
index_type dim;
index_type len;
index_type n;
+ index_type arraysize;
/* The compiler cannot figure out that these are set, initialize
them to avoid warnings. */
@@ -61,11 +62,12 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
soffset = 0;
roffset = 0;
+ arraysize = size0 ((array_t *) array);
+
if (ret->data == NULL)
{
int i;
- ret->data = internal_malloc_size (size * size0 ((array_t *)array));
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -83,13 +85,22 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
}
+
+ if (arraysize > 0)
+ ret->data = internal_malloc_size (size * arraysize);
+ else
+ ret->data = internal_malloc_size (1);
+
}
- else
+ else if (unlikely (compile_options.bounds_check))
{
- if (size0 ((array_t *) ret) == 0)
- return;
+ bounds_equal_extents ((array_t *) ret, (array_t *) array,
+ "return value", "EOSHIFT");
}
+ if (arraysize == 0)
+ return;
+
which = which - 1;
extent[0] = 1;
diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c
index aa5ef5ad90f..2fbf62e118c 100644
--- a/libgfortran/intrinsics/eoshift2.c
+++ b/libgfortran/intrinsics/eoshift2.c
@@ -75,7 +75,6 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
{
int i;
- ret->data = internal_malloc_size (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -92,15 +91,20 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
+ if (arraysize > 0)
+ ret->data = internal_malloc_size (size * arraysize);
+ else
+ ret->data = internal_malloc_size (1);
+
}
}
- else
+ else if (unlikely (compile_options.bounds_check))
{
- if (size0 ((array_t *) ret) == 0)
- return;
+ bounds_equal_extents ((array_t *) ret, (array_t *) array,
+ "return value", "EOSHIFT");
}
- if (arraysize == 0 && filler == NULL)
+ if (arraysize == 0)
return;
which = which - 1;