+2008-05-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32600
+ * trans-expr.c (gfc_conv_function_call): Remove library
+ call for c_f_pointer with scalar Fortran pointers and for
+ c_f_procpointer.
+
2008-05-21 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/36257
arg->expr->ts.kind = sym->ts.derived->ts.kind;
gfc_conv_expr_reference (se, arg->expr);
+ return 0;
+ }
+ else if ((sym->intmod_sym_id == ISOCBINDING_F_POINTER
+ && arg->next->expr->rank == 0)
+ || sym->intmod_sym_id == ISOCBINDING_F_PROCPOINTER)
+ {
+ /* Convert c_f_pointer if fptr is a scalar
+ and convert c_f_procpointer. */
+ gfc_se cptrse;
+ gfc_se fptrse;
+
+ gfc_init_se (&cptrse, NULL);
+ gfc_conv_expr (&cptrse, arg->expr);
+ gfc_add_block_to_block (&se->pre, &cptrse.pre);
+ gfc_add_block_to_block (&se->post, &cptrse.post);
+
+ gfc_init_se (&fptrse, NULL);
+ if (sym->intmod_sym_id == ISOCBINDING_F_POINTER)
+ fptrse.want_pointer = 1;
+
+ gfc_conv_expr (&fptrse, arg->next->expr);
+ gfc_add_block_to_block (&se->pre, &fptrse.pre);
+ gfc_add_block_to_block (&se->post, &fptrse.post);
+
+ tmp = arg->next->expr->symtree->n.sym->backend_decl;
+ se->expr = fold_build2 (MODIFY_EXPR, TREE_TYPE (tmp), fptrse.expr,
+ fold_convert (TREE_TYPE (tmp), cptrse.expr));
+
return 0;
}
else if (sym->intmod_sym_id == ISOCBINDING_ASSOCIATED)
+2008-05-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32600
+ * gfortran.dg/c_f_pointer_tests_3.f90: New.
+
2008-05-25 Richard Guenther <rguenther@suse.de>
PR tree-optimization/17526
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fdump-tree-original" }
+!
+! PR fortran/32600 c_f_pointer w/o shape
+! PR fortran/32580 c_f_procpointer
+!
+! Verify that c_f_prointer [w/o shape] and c_f_procpointer generate
+! the right code - and no library call
+
+program test
+ use iso_c_binding
+ implicit none
+ type(c_ptr) :: cptr
+ type(c_funptr) :: cfunptr
+ integer(4), pointer :: fptr
+ integer(4), pointer :: fptr_array(:)
+! procedure(integer(4)), pointer :: fprocptr ! TODO
+
+ call c_f_pointer(cptr, fptr)
+ call c_f_pointer(cptr, fptr_array, [ 1 ])
+! call c_f_procpointer(cfunptr, fprocptr) ! TODO
+end program test
+
+! Make sure there is only a single function call:
+! { dg-final { scan-tree-dump-times "c_f" 1 "original" } }
+! { dg-final { scan-tree-dump-times "c_f_pointer" 1 "original" } }
+! { dg-final { scan-tree-dump-times "c_f_pointer_i4" 1 "original" } }
+!
+! Check scalar c_f_pointer
+! { dg-final { scan-tree-dump-times " fptr = .integer.kind=4. .. cptr" 1 "original" } }
+!
+! Check c_f_procpointer
+! TODO { scan-tree-dump-times " fprocptr = .integer.kind=4. .\\*<.*>. .void.. cfunptr;" 1 "original" } } TODO
+!
+! { dg-final { cleanup-tree-dump "original" } }
+2008-05-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32600
+ * intrinsics/iso_c_binding.c (c_f_procpointer): Remove.
+ * intrinsics/iso_c_binding.h (c_f_procpointer): Remove.
+ * gfortran.map (c_f_procpointer): Remove.
+
2008-05-22 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libgfortran/36302
__iso_c_binding_c_f_pointer_l4;
__iso_c_binding_c_f_pointer_l8;
__iso_c_binding_c_f_pointer_u0;
- __iso_c_binding_c_f_procpointer;
local:
*;
};
| (GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT);
}
}
-
-
-/* This function will change, once there is an actual f90 type for the
- procedure pointer. */
-
-void
-ISO_C_BINDING_PREFIX (c_f_procpointer) (void *c_ptr_in,
- gfc_array_void *f_ptr_out)
-{
- GFC_DESCRIPTOR_DATA(f_ptr_out) = c_ptr_in;
-}
-
-
void ISO_C_BINDING_PREFIX(c_f_pointer)(void *, gfc_array_void *,
const array_t *, int, int);
-/* The second param here may change, once procedure pointers are
- implemented. */
-void ISO_C_BINDING_PREFIX(c_f_procpointer) (void *, gfc_array_void *);
-
void ISO_C_BINDING_PREFIX(c_f_pointer_u0) (void *, gfc_array_void *,
const array_t *);
void ISO_C_BINDING_PREFIX(c_f_pointer_d0) (void *, gfc_array_void *,