diff options
author | Thomas Koenig <Thomas.Koenig@online.de> | 2006-03-30 16:30:26 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2006-03-30 16:30:26 +0000 |
commit | 6b86a9bc0536c073a70c7fdb563a36afe2dd6fbf (patch) | |
tree | ccefb2ba3589b346ff9e82de690b49f0e7f063c7 /libgfortran | |
parent | c7ec5472672f0e68687081caa28ffb196e9c37a1 (diff) | |
download | gcc-6b86a9bc0536c073a70c7fdb563a36afe2dd6fbf.zip gcc-6b86a9bc0536c073a70c7fdb563a36afe2dd6fbf.tar.gz gcc-6b86a9bc0536c073a70c7fdb563a36afe2dd6fbf.tar.bz2 |
re PR fortran/25031 ([4.1 only] Allocatable array can be reallocated.)
2006-03-30 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/25031
* runtime/memory.c (allocate_array): If stat is present and
the variable is already allocated, free the variable, do
the allocation and set stat.
(allocate_array_64): Likewise. Whitespace fix.
2006-03-30 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/25031
* gfortran.dg/multiple_allocation_1.f90: Check that the
size has changed after a re-allocation with stat.
From-SVN: r112539
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 8 | ||||
-rw-r--r-- | libgfortran/runtime/memory.c | 16 |
2 files changed, 21 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c671337..d082c07 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,11 @@ +2006-03-30 Thomas Koenig <Thomas.Koenig@online.de> + + PR fortran/25031 + * runtime/memory.c (allocate_array): If stat is present and + the variable is already allocated, free the variable, do + the allocation and set stat. + (allocate_array_64): Likewise. Whitespace fix. + 2006-03-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/26880 diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index 34d70f2..db55a55 100644 --- a/libgfortran/runtime/memory.c +++ b/libgfortran/runtime/memory.c @@ -249,7 +249,12 @@ allocate_array (void **mem, GFC_INTEGER_4 size, GFC_INTEGER_4 * stat) return; } if (stat) - *stat = ERROR_ALLOCATION; + { + free (*mem); + allocate (mem, size, stat); + *stat = ERROR_ALLOCATION; + return; + } else runtime_error ("Attempting to allocate already allocated array."); @@ -272,10 +277,15 @@ allocate64_array (void **mem, GFC_INTEGER_8 size, GFC_INTEGER_4 * stat) return; } if (stat) - *stat = ERROR_ALLOCATION; + { + free (*mem); + allocate (mem, size, stat); + *stat = ERROR_ALLOCATION; + return; + } else runtime_error ("Attempting to allocate already allocated array."); - + return; } |