re PR fortran/32600 ([ISO Bind C] C_F_POINTER w/o SHAPE should not be a library function)
authorChristopher D. Rickett <crickett@lanl.gov>
Thu, 19 Jul 2007 06:14:19 +0000 (06:14 +0000)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 19 Jul 2007 06:14:19 +0000 (08:14 +0200)
2007-07-19  Christopher D. Rickett  <crickett@lanl.gov>

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.

From-SVN: r126744

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 0c46c5b5df3b9ca3e19ea0aea97933f6cecc83b5..476b73eb22d9884a95f03364052439bfc5e21fc3 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 fce615935409a32c6cbb2fdf8958a8633708fd74..16148cb0a6215d5aba525c478d8202730618146c 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 a6b20fb751181a2dec1c079ef889c0281adfc489..560e8bc5d9486fc6b172192c9b86288238145703 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 76dba0ce40659bdf5888992ac0f2c5c87411f88d..f8d184a5079d651908e8df567872608c1023f76b 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 33575475aa61d956e81cdb8a2394de4142aa63ed..d73a9ce93d78d00f88638c63021c2fb6ca0c64f0 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 afd85529e9df052d28a8b47e2628e5b0baed0c8c..1e51ad53d2d9218ee92f0df3752b60ea16d4ce6b 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