OSDN Git Service

2007-07-19 Christopher D. Rickett <crickett@lanl.gov>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Jul 2007 06:14:19 +0000 (06:14 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Jul 2007 06:14:19 +0000 (06:14 +0000)
PR fortran/32600
* trans-expr.c (gfc_conv_function_call): Inline C_LOC.

2007-07-19  Christopher D. Rickett  <crickett@lanl.gov>

PR fortran/32600
* libgfortran/intrinsics/iso_c_binding.c: Remove C_LOC.
* libgfortran/intrinsics/iso_c_binding.h: Ditto.
* libgfortran/gfortran.map: Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126744 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c
libgfortran/ChangeLog
libgfortran/gfortran.map
libgfortran/intrinsics/iso_c_binding.c
libgfortran/intrinsics/iso_c_binding.h

index 0c46c5b..476b73e 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-19  Christopher D. Rickett  <crickett@lanl.gov>
+
+       PR fortran/32600
+       * trans-expr.c (gfc_conv_function_call): Inline C_LOC.
+
 2007-07-18  Christopher D. Rickett  <crickett@lanl.gov>
 
        PR fortran/32801
index fce6159..16148cb 100644 (file)
@@ -2060,6 +2060,33 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
   var = NULL_TREE;
   len = NULL_TREE;
 
+  if (sym->from_intmod == INTMOD_ISO_C_BINDING
+      && sym->intmod_sym_id == ISOCBINDING_LOC)
+    {
+      if (arg->expr->rank == 0)
+       {
+         gfc_conv_expr_reference (se, arg->expr);
+       }
+      else
+       {
+         int f;
+         /* This is really the actual arg because no formal arglist is
+            created for C_LOC.  */
+         fsym = arg->expr->symtree->n.sym;
+
+         /* We should want it to do g77 calling convention.  */
+         f = (fsym != NULL)
+           && !(fsym->attr.pointer || fsym->attr.allocatable)
+           && fsym->as->type != AS_ASSUMED_SHAPE;
+         f = f || !sym->attr.always_explicit;
+         
+         argss = gfc_walk_expr (arg->expr);
+         gfc_conv_array_parameter (se, arg->expr, argss, f);
+       }
+
+      return 0;
+    }
+  
   if (se->ss != NULL)
     {
       if (!sym->attr.elemental)
index a6b20fb..560e8bc 100644 (file)
@@ -1,3 +1,10 @@
+2007-07-19  Christopher D. Rickett  <crickett@lanl.gov>
+
+       PR fortran/32600
+       * libgfortran/intrinsics/iso_c_binding.c: Remove C_LOC.
+       * libgfortran/intrinsics/iso_c_binding.h: Ditto.
+       * libgfortran/gfortran.map: Ditto.
+
 2007-07-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
            Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
index 76dba0c..f8d184a 100644 (file)
@@ -1019,7 +1019,6 @@ GFORTRAN_1.0 {
     __iso_c_binding_c_f_pointer_u0;
     __iso_c_binding_c_f_procpointer;
     __iso_c_binding_c_funloc;
-    __iso_c_binding_c_loc;
   local:
     *;
 };
index 3357547..d73a9ce 100644 (file)
@@ -213,23 +213,6 @@ ISO_C_BINDING_PREFIX (c_associated_2) (void *c_ptr_in_1, void *c_ptr_in_2)
 }
 
 
-/* Return the C address of the given Fortran allocatable object.  */
-
-void *
-ISO_C_BINDING_PREFIX (c_loc) (void *f90_obj)
-{
-  if (f90_obj == NULL)
-    {
-      runtime_error ("C_LOC: Attempt to get C address for Fortran object"
-                     " that has not been allocated or associated");
-      abort ();
-    }
-   
-  /* The "C" address should be the address of the object in Fortran.  */
-  return f90_obj;
-}
-
-
 /*  Return the C address of the given Fortran procedure.  This
     routine is expected to return a derived type of type C_FUNPTR,
     which represents the C address of the given Fortran object.  */
index afd8552..1e51ad5 100644 (file)
@@ -64,7 +64,6 @@ void ISO_C_BINDING_PREFIX(c_f_pointer_u0) (void *, gfc_array_void *,
 void ISO_C_BINDING_PREFIX(c_f_pointer_d0) (void *, gfc_array_void *,
                                           const array_t *);
 
-void *ISO_C_BINDING_PREFIX(c_loc) (void *);
 void *ISO_C_BINDING_PREFIX(c_funloc) (void *);
 
 #endif