summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-06 18:50:46 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-06 18:50:46 +0000
commitc35c4565e1f04d4be40a68e5fcb68db50024b386 (patch)
tree1f96f3a424bb11e17792992ccf191f0a1523b244 /libgfortran
parentb610dcb9afb3ebcc18867e3491d01034f76a0295 (diff)
downloadgcc-c35c4565e1f04d4be40a68e5fcb68db50024b386.tar.gz
2011-07-06 Thomas Koenig <tkoenig@gcc.gnu.org>
Partial backport from trunk: PR fortran/49479 * runtime/memory.c: If size is zero, allocate a single byte. * m4/eoshift1.m4: Remove double allocation. * m4/eoshift3.m4: Likewise. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift1_16.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. * generated/eoshift3_16.c: Regenerated. 2011-07-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/49479 * gfortran.dg/reshape_zerosize_3.f90: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@175929 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog14
-rw-r--r--libgfortran/generated/eoshift1_16.c1
-rw-r--r--libgfortran/generated/eoshift1_4.c1
-rw-r--r--libgfortran/generated/eoshift1_8.c1
-rw-r--r--libgfortran/generated/eoshift3_16.c1
-rw-r--r--libgfortran/generated/eoshift3_4.c1
-rw-r--r--libgfortran/generated/eoshift3_8.c1
-rw-r--r--libgfortran/m4/eoshift1.m41
-rw-r--r--libgfortran/m4/eoshift3.m41
-rw-r--r--libgfortran/runtime/memory.c4
10 files changed, 16 insertions, 10 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 3da26246820..85b02a5f80b 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,17 @@
+2011-07-06 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Partial backport from trunk:
+ PR fortran/49479
+ * runtime/memory.c: If size is zero, allocate a single byte.
+ * m4/eoshift1.m4: Remove double allocation.
+ * m4/eoshift3.m4: Likewise.
+ * generated/eoshift1_4.c: Regenerated.
+ * generated/eoshift1_8.c: Regenerated.
+ * generated/eoshift1_16.c: Regenerated.
+ * generated/eoshift3_4.c: Regenerated.
+ * generated/eoshift3_8.c: Regenerated.
+ * generated/eoshift3_16.c: Regenerated.
+
2011-07-03 Janne Blomqvist <jb@gcc.gnu.org>
Backport from mainline:
diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c
index a14bd292715..48fa03b6760 100644
--- a/libgfortran/generated/eoshift1_16.c
+++ b/libgfortran/generated/eoshift1_16.c
@@ -88,7 +88,6 @@ eoshift1 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c
index 06bc309c4a8..3b9f7309c58 100644
--- a/libgfortran/generated/eoshift1_4.c
+++ b/libgfortran/generated/eoshift1_4.c
@@ -88,7 +88,6 @@ eoshift1 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c
index 3e9162d0f08..60c8667bd91 100644
--- a/libgfortran/generated/eoshift1_8.c
+++ b/libgfortran/generated/eoshift1_8.c
@@ -88,7 +88,6 @@ eoshift1 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c
index ec21d1ec14d..95772e9a8cd 100644
--- a/libgfortran/generated/eoshift3_16.c
+++ b/libgfortran/generated/eoshift3_16.c
@@ -89,7 +89,6 @@ eoshift3 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c
index ce4cede1f1d..04cbd9f03b1 100644
--- a/libgfortran/generated/eoshift3_4.c
+++ b/libgfortran/generated/eoshift3_4.c
@@ -89,7 +89,6 @@ eoshift3 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c
index 4af36f72bb4..f2b5a8a5012 100644
--- a/libgfortran/generated/eoshift3_8.c
+++ b/libgfortran/generated/eoshift3_8.c
@@ -89,7 +89,6 @@ eoshift3 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4
index be9b1008a60..b99b3d1a0c1 100644
--- a/libgfortran/m4/eoshift1.m4
+++ b/libgfortran/m4/eoshift1.m4
@@ -89,7 +89,6 @@ eoshift1 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4
index 6fa3bd2f7dc..d1b10b56c4e 100644
--- a/libgfortran/m4/eoshift3.m4
+++ b/libgfortran/m4/eoshift3.m4
@@ -90,7 +90,6 @@ eoshift3 (gfc_array_char * const restrict ret,
{
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++)
diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c
index 5f710849e52..a26d9e59efa 100644
--- a/libgfortran/runtime/memory.c
+++ b/libgfortran/runtime/memory.c
@@ -54,8 +54,8 @@ get_mem (size_t n)
void *
internal_malloc_size (size_t size)
{
- if (size == 0)
- return NULL;
+ if (unlikely (size == 0))
+ size = 1;
return get_mem (size);
}