This is the mail archive of the gcc-patches@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]

Re: [Patch, Fortran, OOP] PR 45290/45271: pointer initialization / vtab init


2010/8/20 Dominique Dhumieres <dominiq@lps.ens.fr>:
> With your third patch, I see linker errors of the kind:
>
> Undefined symbols:
> ?"_strategy_pre_update_", referenced from:
> ? ? ?___basestrategy_MOD_vtab$strategy in ccA9fpVZ.o
> ?"_strategy_post_update_", referenced from:
> ? ? ?___basestrategy_MOD_vtab$strategy in ccA9fpVZ.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
>
> (test in comment #1 of pr44863).


Ok, I have identified the problem. Actually the first module of this
test case (plus an empty main program) is sufficient to reproduce the
problem. When setting the initializers, I was checking for ABSTRACT,
while the correct thing to do is checking for the DEFERRED attribute
(the ABSTRACT attribute of the interfaces may not be known yet when
the class container is constructed):


@@ -228,18 +226,19 @@ add_proc_comp (gfc_symbol *vtype, const char *name
       c->attr.external = 1;
       c->attr.untyped = 1;
       c->attr.if_source = IFSRC_IFBODY;
-
-      /* A static initializer cannot be used here because the specific
-	function is not a constant; internal compiler error: in
-	output_constant, at varasm.c:4623  */
-      c->initializer = NULL;
     }
   else if (c->attr.proc_pointer && c->tb)
     {
       *c->tb = *tb;
       c->tb->ppc = 1;
-      c->ts.interface = tb->u.specific->n.sym;	
     }
+
+  if (tb->u.specific)
+    {
+      c->ts.interface = tb->u.specific->n.sym;
+      if (!tb->deferred)
+	c->initializer = gfc_get_variable_expr (tb->u.specific);
+    }
 }


The attached version #4 of the patch is still free of testsuite
regressions and fixes comment #1 of pr44863 (which I will also add to
the testsuite to catch things like this in the future).

Ok to commit?

Cheers,
Janus

Attachment: vtab_init_v4.diff
Description: Binary data


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