summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/trans-expr.c27
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/gfortran.map1
-rw-r--r--libgfortran/intrinsics/iso_c_binding.c17
-rw-r--r--libgfortran/intrinsics/iso_c_binding.h1
6 files changed, 39 insertions, 19 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0c46c5b5df3..476b73eb22d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index fce61593540..16148cb0a62 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -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)
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index a6b20fb7511..560e8bc5d94 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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>
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 76dba0ce406..f8d184a5079 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -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:
*;
};
diff --git a/libgfortran/intrinsics/iso_c_binding.c b/libgfortran/intrinsics/iso_c_binding.c
index 33575475aa6..d73a9ce93d7 100644
--- a/libgfortran/intrinsics/iso_c_binding.c
+++ b/libgfortran/intrinsics/iso_c_binding.c
@@ -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. */
diff --git a/libgfortran/intrinsics/iso_c_binding.h b/libgfortran/intrinsics/iso_c_binding.h
index afd85529e9d..1e51ad53d2d 100644
--- a/libgfortran/intrinsics/iso_c_binding.h
+++ b/libgfortran/intrinsics/iso_c_binding.h
@@ -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