From a2434150d8126b38ea7c3b0bcf3b4519876fa2bd Mon Sep 17 00:00:00 2001 From: jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Sun, 1 Jul 2007 12:08:59 +0000 Subject: fortran frontend: 2007-07-01 Janne Blomqvist <jb@gcc.gnu.org> * trans.h: Remove decls for 64-bit allocation functions. * trans-array.c (gfc_grow_array): Always pick the standard realloc function decl. (gfc_array_allocate): Likewise. * trans-decl.c: Remove trees for 64-bit allocation functions. (gfc_build_builtin_function_decls): Don't build fndecls for 64-bit allocations functions, use index_int_type for normal allocation functions. libgfortran changelog: 2007-07-01 Janne Blomqvist <jb@gcc.gnu.org> * runtime/memory.c (internal_realloc): Use index_type for size argument instead of GFC_INTEGER_4. (allocate_array): Likewise. (allocate): Likewise, add ifdef around unnecessary check. (internal_reallo64): Remove. (allocate_array64): Remove. (allocate64): Remove. * gfortran.map: Remove symbols for 64-bit allocation functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126166 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 11 ++++++ libgfortran/gfortran.map | 3 -- libgfortran/runtime/memory.c | 79 +++++++------------------------------------- 3 files changed, 23 insertions(+), 70 deletions(-) (limited to 'libgfortran') diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 0b5afdecb3c..1b6a6bdcd9a 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,14 @@ +2007-07-01 Janne Blomqvist <jb@gcc.gnu.org> + + * runtime/memory.c (internal_realloc): Use index_type for size + argument instead of GFC_INTEGER_4. + (allocate_array): Likewise. + (allocate): Likewise, add ifdef around unnecessary check. + (internal_reallo64): Remove. + (allocate_array64): Remove. + (allocate64): Remove. + * gfortran.map: Remove symbols for 64-bit allocation functions. + 2007-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/32456 diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map index f67192db1d8..e1357845ddc 100644 --- a/libgfortran/gfortran.map +++ b/libgfortran/gfortran.map @@ -10,8 +10,6 @@ GFORTRAN_1.0 { _gfortran_all_l4; _gfortran_all_l8; _gfortran_allocate; - _gfortran_allocate64; - _gfortran_allocate64_array; _gfortran_allocate_array; _gfortran_any_l16; _gfortran_any_l4; @@ -168,7 +166,6 @@ GFORTRAN_1.0 { _gfortran_ierrno_i8; _gfortran_internal_pack; _gfortran_internal_realloc; - _gfortran_internal_realloc64; _gfortran_internal_unpack; _gfortran_irand; _gfortran_isatty_l4; diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index 53643dc7ec6..7d893716978 100644 --- a/libgfortran/runtime/memory.c +++ b/libgfortran/runtime/memory.c @@ -1,5 +1,5 @@ /* Memory management routines. - Copyright 2002, 2005, 2006 Free Software Foundation, Inc. + Copyright 2002, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -102,11 +102,11 @@ internal_realloc_size (void *mem, size_t size) return mem; } -extern void *internal_realloc (void *, GFC_INTEGER_4); +extern void *internal_realloc (void *, index_type); export_proto(internal_realloc); void * -internal_realloc (void *mem, GFC_INTEGER_4 size) +internal_realloc (void *mem, index_type size) { #ifdef GFC_CHECK_MEMORY /* Under normal circumstances, this is _never_ going to happen! */ @@ -116,21 +116,6 @@ internal_realloc (void *mem, GFC_INTEGER_4 size) return internal_realloc_size (mem, (size_t) size); } -extern void *internal_realloc64 (void *, GFC_INTEGER_8); -export_proto(internal_realloc64); - -void * -internal_realloc64 (void *mem, GFC_INTEGER_8 size) -{ -#ifdef GFC_CHECK_MEMORY - /* Under normal circumstances, this is _never_ going to happen! */ - if (size < 0) - runtime_error ("Attempt to allocate a negative amount of memory."); -#endif - return internal_realloc_size (mem, (size_t) size); -} - - /* User-allocate, one call for each member of the alloc-list of an ALLOCATE statement. */ @@ -157,12 +142,15 @@ allocate_size (size_t size, GFC_INTEGER_4 * stat) return newmem; } -extern void *allocate (GFC_INTEGER_4, GFC_INTEGER_4 *); +extern void *allocate (index_type, GFC_INTEGER_4 *); export_proto(allocate); void * -allocate (GFC_INTEGER_4 size, GFC_INTEGER_4 * stat) +allocate (index_type size, GFC_INTEGER_4 * stat) { +#ifdef GFC_CHECK_MEMORY + /* The only time this can happen is the size computed by the + frontend wraps around. */ if (size < 0) { if (stat) @@ -174,40 +162,19 @@ allocate (GFC_INTEGER_4 size, GFC_INTEGER_4 * stat) runtime_error ("Attempt to allocate negative amount of memory. " "Possible integer overflow"); } - - return allocate_size ((size_t) size, stat); -} - -extern void *allocate64 (GFC_INTEGER_8, GFC_INTEGER_4 *); -export_proto(allocate64); - -void * -allocate64 (GFC_INTEGER_8 size, GFC_INTEGER_4 * stat) -{ - if (size < 0) - { - if (stat) - { - *stat = ERROR_ALLOCATION; - return NULL; - } - else - runtime_error ("ALLOCATE64: Attempt to allocate negative amount of " - "memory. Possible integer overflow"); - } - +#endif return allocate_size ((size_t) size, stat); } /* Function to call in an ALLOCATE statement when the argument is an allocatable array. If the array is currently allocated, it is - an error to allocate it again. 32-bit version. */ + an error to allocate it again. */ -extern void *allocate_array (void *, GFC_INTEGER_4, GFC_INTEGER_4 *); +extern void *allocate_array (void *, index_type, GFC_INTEGER_4 *); export_proto(allocate_array); void * -allocate_array (void *mem, GFC_INTEGER_4 size, GFC_INTEGER_4 * stat) +allocate_array (void *mem, index_type size, GFC_INTEGER_4 * stat) { if (mem == NULL) return allocate (size, stat); @@ -222,28 +189,6 @@ allocate_array (void *mem, GFC_INTEGER_4 size, GFC_INTEGER_4 * stat) runtime_error ("Attempting to allocate already allocated array."); } -/* Function to call in an ALLOCATE statement when the argument is an - allocatable array. If the array is currently allocated, it is - an error to allocate it again. 64-bit version. */ - -extern void *allocate64_array (void *, GFC_INTEGER_8, GFC_INTEGER_4 *); -export_proto(allocate64_array); - -void * -allocate64_array (void *mem, GFC_INTEGER_8 size, GFC_INTEGER_4 * stat) -{ - if (mem == NULL) - return allocate64 (size, stat); - if (stat) - { - free (mem); - mem = allocate (size, stat); - *stat = ERROR_ALLOCATION; - return mem; - } - - runtime_error ("Attempting to allocate already allocated array."); -} /* User-deallocate; pointer is then NULLified by the front-end. */ -- cgit v1.2.1