summaryrefslogtreecommitdiff
path: root/libgfortran/generated
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-28 18:59:04 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-28 18:59:04 +0000
commit568408e3a3f848fb9b3cb3cf2b80cb9c7012b0b5 (patch)
tree065be10e884faa1cf29e82bd342b95d03ee62f80 /libgfortran/generated
parent94bbf49527a6dc8f36a24a97fa3ea21cbd1633bf (diff)
downloadgcc-568408e3a3f848fb9b3cb3cf2b80cb9c7012b0b5.tar.gz
2011-06-28 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/49479 * m4/reshape.m4: If source allocation is smaller than one, set it to one. * intrinsics/reshape_generic.c: Likewise. * generated/reshape_r16.c: Regenerated. * generated/reshape_c4.c: Regenerated. * generated/reshape_c16.c: Regenerated. * generated/reshape_c8.c: Regenerated. * generated/reshape_r4.c: Regenerated. * generated/reshape_i4.c: Regenerated. * generated/reshape_r10.c: Regenerated. * generated/reshape_r8.c: Regenerated. * generated/reshape_c10.c: Regenerated. * generated/reshape_i8.c: Regenerated. * generated/reshape_i16.c: Regenerated. 2011-06-28 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/49479 * gfortran.dg/reshape_zerosize_3.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175594 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/generated')
-rw-r--r--libgfortran/generated/reshape_c10.c10
-rw-r--r--libgfortran/generated/reshape_c16.c10
-rw-r--r--libgfortran/generated/reshape_c4.c10
-rw-r--r--libgfortran/generated/reshape_c8.c10
-rw-r--r--libgfortran/generated/reshape_i16.c10
-rw-r--r--libgfortran/generated/reshape_i4.c10
-rw-r--r--libgfortran/generated/reshape_i8.c10
-rw-r--r--libgfortran/generated/reshape_r10.c10
-rw-r--r--libgfortran/generated/reshape_r16.c10
-rw-r--r--libgfortran/generated/reshape_r4.c10
-rw-r--r--libgfortran/generated/reshape_r8.c10
11 files changed, 99 insertions, 11 deletions
diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c
index 34eff9086a0..44446ebfee8 100644
--- a/libgfortran/generated/reshape_c10.c
+++ b/libgfortran/generated/reshape_c10.c
@@ -97,6 +97,8 @@ reshape_c10 (gfc_array_c10 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_c10 (gfc_array_c10 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_COMPLEX_10));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_COMPLEX_10);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c
index 569b76ce4a8..ca588dc2c93 100644
--- a/libgfortran/generated/reshape_c16.c
+++ b/libgfortran/generated/reshape_c16.c
@@ -97,6 +97,8 @@ reshape_c16 (gfc_array_c16 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_c16 (gfc_array_c16 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_COMPLEX_16));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_COMPLEX_16);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c
index c8b7355de37..e16d32c5239 100644
--- a/libgfortran/generated/reshape_c4.c
+++ b/libgfortran/generated/reshape_c4.c
@@ -97,6 +97,8 @@ reshape_c4 (gfc_array_c4 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_c4 (gfc_array_c4 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_COMPLEX_4));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_COMPLEX_4);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c
index 1a390b4509b..c8da0bc5f6a 100644
--- a/libgfortran/generated/reshape_c8.c
+++ b/libgfortran/generated/reshape_c8.c
@@ -97,6 +97,8 @@ reshape_c8 (gfc_array_c8 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_c8 (gfc_array_c8 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_COMPLEX_8));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_COMPLEX_8);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c
index 4f69ce0d287..43fbefc8ccb 100644
--- a/libgfortran/generated/reshape_i16.c
+++ b/libgfortran/generated/reshape_i16.c
@@ -97,6 +97,8 @@ reshape_16 (gfc_array_i16 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_16 (gfc_array_i16 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_INTEGER_16));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_INTEGER_16);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c
index 53016bdf597..2c136deeae2 100644
--- a/libgfortran/generated/reshape_i4.c
+++ b/libgfortran/generated/reshape_i4.c
@@ -97,6 +97,8 @@ reshape_4 (gfc_array_i4 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_4 (gfc_array_i4 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_INTEGER_4));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_INTEGER_4);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c
index 34620cf6d40..c97b747ee6d 100644
--- a/libgfortran/generated/reshape_i8.c
+++ b/libgfortran/generated/reshape_i8.c
@@ -97,6 +97,8 @@ reshape_8 (gfc_array_i8 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_8 (gfc_array_i8 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_INTEGER_8));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_INTEGER_8);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c
index 3bf319aa434..fa3873e1617 100644
--- a/libgfortran/generated/reshape_r10.c
+++ b/libgfortran/generated/reshape_r10.c
@@ -97,6 +97,8 @@ reshape_r10 (gfc_array_r10 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_r10 (gfc_array_r10 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_REAL_10));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_REAL_10);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c
index 6794b506059..c2b6556b017 100644
--- a/libgfortran/generated/reshape_r16.c
+++ b/libgfortran/generated/reshape_r16.c
@@ -97,6 +97,8 @@ reshape_r16 (gfc_array_r16 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_r16 (gfc_array_r16 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_REAL_16));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_REAL_16);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c
index e7bfbfbf538..2b859fca7d8 100644
--- a/libgfortran/generated/reshape_r4.c
+++ b/libgfortran/generated/reshape_r4.c
@@ -97,6 +97,8 @@ reshape_r4 (gfc_array_r4 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_r4 (gfc_array_r4 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_REAL_4));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_REAL_4);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c
index d0441c0fe5d..49b23524fdb 100644
--- a/libgfortran/generated/reshape_r8.c
+++ b/libgfortran/generated/reshape_r8.c
@@ -97,6 +97,8 @@ reshape_r8 (gfc_array_r8 * const restrict ret,
if (ret->data == NULL)
{
+ index_type alloc_size;
+
rs = 1;
for (n = 0; n < rdim; n++)
{
@@ -107,7 +109,13 @@ reshape_r8 (gfc_array_r8 * const restrict ret,
rs *= rex;
}
ret->offset = 0;
- ret->data = internal_malloc_size ( rs * sizeof (GFC_REAL_8));
+
+ if (unlikely (rs < 1))
+ alloc_size = 1;
+ else
+ alloc_size = rs * sizeof (GFC_REAL_8);
+
+ ret->data = internal_malloc_size (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}