OSDN Git Service

fortran frontend:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Jul 2007 12:08:59 +0000 (12:08 +0000)
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Jul 2007 12:08:59 +0000 (12:08 +0000)
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

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans-decl.c
gcc/fortran/trans.h
libgfortran/ChangeLog
libgfortran/gfortran.map
libgfortran/runtime/memory.c

index 7c0618d..d76029d 100644 (file)
@@ -1,3 +1,14 @@
+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.
+
 2007-06-30  Daniel Franke  <franke.daniel@gmail.com>
 
        PR fortran/20373
 2007-06-30  Daniel Franke  <franke.daniel@gmail.com>
 
        PR fortran/20373
index 8b13e67..07862d6 100644 (file)
@@ -842,11 +842,9 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra)
   arg1 = build2 (MULT_EXPR, gfc_array_index_type, tmp,
                 fold_convert (gfc_array_index_type, size));
 
   arg1 = build2 (MULT_EXPR, gfc_array_index_type, tmp,
                 fold_convert (gfc_array_index_type, size));
 
-  /* Pick the appropriate realloc function.  */
-  if (gfc_index_integer_kind == 4)
+  /* Pick the realloc function.  */
+  if (gfc_index_integer_kind == 4 || gfc_index_integer_kind == 8)
     tmp = gfor_fndecl_internal_realloc;
     tmp = gfor_fndecl_internal_realloc;
-  else if (gfc_index_integer_kind == 8)
-    tmp = gfor_fndecl_internal_realloc64;
   else
     gcc_unreachable ();
 
   else
     gcc_unreachable ();
 
@@ -3575,20 +3573,14 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
   pointer = gfc_conv_descriptor_data_get (se->expr);
   STRIP_NOPS (pointer);
 
   pointer = gfc_conv_descriptor_data_get (se->expr);
   STRIP_NOPS (pointer);
 
-  if (TYPE_PRECISION (gfc_array_index_type) == 32)
+  if (TYPE_PRECISION (gfc_array_index_type) == 32 ||
+      TYPE_PRECISION (gfc_array_index_type) == 64)
     {
       if (allocatable_array)
        allocate = gfor_fndecl_allocate_array;
       else
        allocate = gfor_fndecl_allocate;
     }
     {
       if (allocatable_array)
        allocate = gfor_fndecl_allocate_array;
       else
        allocate = gfor_fndecl_allocate;
     }
-  else if (TYPE_PRECISION (gfc_array_index_type) == 64)
-    {
-      if (allocatable_array)
-       allocate = gfor_fndecl_allocate64_array;
-      else
-       allocate = gfor_fndecl_allocate64;
-    }
   else
     gcc_unreachable ();
 
   else
     gcc_unreachable ();
 
index 0ab2d74..e1379ba 100644 (file)
@@ -75,11 +75,8 @@ tree gfc_static_ctors;
 /* Function declarations for builtin library functions.  */
 
 tree gfor_fndecl_internal_realloc;
 /* Function declarations for builtin library functions.  */
 
 tree gfor_fndecl_internal_realloc;
-tree gfor_fndecl_internal_realloc64;
 tree gfor_fndecl_allocate;
 tree gfor_fndecl_allocate;
-tree gfor_fndecl_allocate64;
 tree gfor_fndecl_allocate_array;
 tree gfor_fndecl_allocate_array;
-tree gfor_fndecl_allocate64_array;
 tree gfor_fndecl_deallocate;
 tree gfor_fndecl_pause_numeric;
 tree gfor_fndecl_pause_string;
 tree gfor_fndecl_deallocate;
 tree gfor_fndecl_pause_numeric;
 tree gfor_fndecl_pause_string;
@@ -2241,46 +2238,28 @@ gfc_build_builtin_function_decls (void)
 {
   tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
   tree gfc_int4_type_node = gfc_get_int_type (4);
 {
   tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
   tree gfc_int4_type_node = gfc_get_int_type (4);
-  tree gfc_int8_type_node = gfc_get_int_type (8);
   tree gfc_logical4_type_node = gfc_get_logical_type (4);
   tree gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node);
   tree gfc_logical4_type_node = gfc_get_logical_type (4);
   tree gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node);
+  tree gfc_index_int_type_node = gfc_get_int_type (gfc_index_integer_kind);
 
   gfor_fndecl_internal_realloc =
     gfc_build_library_function_decl (get_identifier
                                     (PREFIX("internal_realloc")),
                                     pvoid_type_node, 2, pvoid_type_node,
 
   gfor_fndecl_internal_realloc =
     gfc_build_library_function_decl (get_identifier
                                     (PREFIX("internal_realloc")),
                                     pvoid_type_node, 2, pvoid_type_node,
-                                    gfc_int4_type_node);
-
-  gfor_fndecl_internal_realloc64 =
-    gfc_build_library_function_decl (get_identifier
-                                    (PREFIX("internal_realloc64")),
-                                    pvoid_type_node, 2, pvoid_type_node,
-                                    gfc_int8_type_node);
+                                    gfc_index_int_type_node);
 
   gfor_fndecl_allocate =
     gfc_build_library_function_decl (get_identifier (PREFIX("allocate")),
                                     pvoid_type_node, 2,
 
   gfor_fndecl_allocate =
     gfc_build_library_function_decl (get_identifier (PREFIX("allocate")),
                                     pvoid_type_node, 2,
-                                    gfc_int4_type_node, gfc_pint4_type_node);
+                                    gfc_index_int_type_node, gfc_pint4_type_node);
   DECL_IS_MALLOC (gfor_fndecl_allocate) = 1;
 
   DECL_IS_MALLOC (gfor_fndecl_allocate) = 1;
 
-  gfor_fndecl_allocate64 =
-    gfc_build_library_function_decl (get_identifier (PREFIX("allocate64")),
-                                    pvoid_type_node, 2,
-                                    gfc_int8_type_node, gfc_pint4_type_node);
-  DECL_IS_MALLOC (gfor_fndecl_allocate64) = 1;
-
   gfor_fndecl_allocate_array =
     gfc_build_library_function_decl (get_identifier (PREFIX("allocate_array")),
                                     pvoid_type_node, 3, pvoid_type_node,
   gfor_fndecl_allocate_array =
     gfc_build_library_function_decl (get_identifier (PREFIX("allocate_array")),
                                     pvoid_type_node, 3, pvoid_type_node,
-                                    gfc_int4_type_node, gfc_pint4_type_node);
+                                    gfc_index_int_type_node, gfc_pint4_type_node);
   DECL_IS_MALLOC (gfor_fndecl_allocate_array) = 1;
 
   DECL_IS_MALLOC (gfor_fndecl_allocate_array) = 1;
 
-  gfor_fndecl_allocate64_array =
-    gfc_build_library_function_decl (get_identifier (PREFIX("allocate64_array")),
-                                    pvoid_type_node, 3, pvoid_type_node,
-                                    gfc_int8_type_node, gfc_pint4_type_node);
-  DECL_IS_MALLOC (gfor_fndecl_allocate64_array) = 1;
-
   gfor_fndecl_deallocate =
     gfc_build_library_function_decl (get_identifier (PREFIX("deallocate")),
                                     void_type_node, 2, pvoid_type_node,
   gfor_fndecl_deallocate =
     gfc_build_library_function_decl (get_identifier (PREFIX("deallocate")),
                                     void_type_node, 2, pvoid_type_node,
index f2a5d44..a57deca 100644 (file)
@@ -482,11 +482,8 @@ void gfc_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, tree);
 
 /* Runtime library function decls.  */
 extern GTY(()) tree gfor_fndecl_internal_realloc;
 
 /* Runtime library function decls.  */
 extern GTY(()) tree gfor_fndecl_internal_realloc;
-extern GTY(()) tree gfor_fndecl_internal_realloc64;
 extern GTY(()) tree gfor_fndecl_allocate;
 extern GTY(()) tree gfor_fndecl_allocate;
-extern GTY(()) tree gfor_fndecl_allocate64;
 extern GTY(()) tree gfor_fndecl_allocate_array;
 extern GTY(()) tree gfor_fndecl_allocate_array;
-extern GTY(()) tree gfor_fndecl_allocate64_array;
 extern GTY(()) tree gfor_fndecl_deallocate;
 extern GTY(()) tree gfor_fndecl_pause_numeric;
 extern GTY(()) tree gfor_fndecl_pause_string;
 extern GTY(()) tree gfor_fndecl_deallocate;
 extern GTY(()) tree gfor_fndecl_pause_numeric;
 extern GTY(()) tree gfor_fndecl_pause_string;
index 0b5afde..1b6a6bd 100644 (file)
@@ -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
 2007-06-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/32456
index f67192d..e135784 100644 (file)
@@ -10,8 +10,6 @@ GFORTRAN_1.0 {
     _gfortran_all_l4;
     _gfortran_all_l8;
     _gfortran_allocate;
     _gfortran_all_l4;
     _gfortran_all_l8;
     _gfortran_allocate;
-    _gfortran_allocate64;
-    _gfortran_allocate64_array;
     _gfortran_allocate_array;
     _gfortran_any_l16;
     _gfortran_any_l4;
     _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_ierrno_i8;
     _gfortran_internal_pack;
     _gfortran_internal_realloc;
-    _gfortran_internal_realloc64;
     _gfortran_internal_unpack;
     _gfortran_irand;
     _gfortran_isatty_l4;
     _gfortran_internal_unpack;
     _gfortran_irand;
     _gfortran_isatty_l4;
index 53643dc..7d89371 100644 (file)
@@ -1,5 +1,5 @@
 /* Memory management routines.
 /* 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).
    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;
 }
 
   return mem;
 }
 
-extern void *internal_realloc (void *, GFC_INTEGER_4);
+extern void *internal_realloc (void *, index_type);
 export_proto(internal_realloc);
 
 void *
 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!  */
 {
 #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);
 }
 
   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. */
 
 /* 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;
 }
 
   return newmem;
 }
 
-extern void *allocate (GFC_INTEGER_4, GFC_INTEGER_4 *);
+extern void *allocate (index_type, GFC_INTEGER_4 *);
 export_proto(allocate);
 
 void *
 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)
   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");
     }
        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
   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 *
 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);
 {
   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.");
 }
 
   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. */
 
 
 /* User-deallocate; pointer is then NULLified by the front-end. */