This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/46974] ICE with TRANSFER using a C_PTR entity


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46974

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-12-18 15:38:18 UTC ---
Draft patch:

--- a/gcc/fortran/target-memory.c
+++ b/gcc/fortran/target-memory.c
@@ -445,6 +445,21 @@ gfc_interpret_derived (unsigned char *buffer, size_t
buffer_size, gfc_expr *resu
   type = gfc_typenode_for_spec (&result->ts);
   cmp = result->ts.u.derived->components;

+  if (result->ts.u.derived->from_intmod == INTMOD_ISO_C_BINDING
+      && (result->ts.u.derived->intmod_sym_id == ISOCBINDING_PTR
+         || result->ts.u.derived->intmod_sym_id == ISOCBINDING_FUNPTR))
+    {
+      gfc_constructor *c;
+      gfc_expr *e = gfc_get_constant_expr (cmp->ts.type, cmp->ts.kind,
+                                          &result->where); 
+      c = gfc_constructor_append_expr (&result->value.constructor, e, NULL);
+      c->n.component = cmp;
+      gfc_target_interpret_expr (buffer, buffer_size, e);
+      e->ts = result->ts;
+      e->ts.is_iso_c = 1;
+      return int_size_in_bytes (ptr_type_node);
+    }
+
   /* Run through the derived type components.  */
   for (;cmp; cmp = cmp->next)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]