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


> This will guarantee that we only generate the backend_decl once.
> However, this will only work if we use build_function_decl instead of
> gfc_get_extern_function_decl when building the decl for the first time
> (since they are not equivalent), which can be accomplished by this
> patchlet:
>
> @@ -1160,12 +1163,21 @@ gfc_get_symbol_decl (gfc_symbol * sym)
> ? ? ? ?}
> ? ? }
>
> - ?/* Catch function declarations. ?Only used for actual parameters and
> - ? ? procedure pointers. ?*/
> + ?/* Catch function declarations. ?Only used for actual parameters,
> + ? ? procedure pointers and procptr initialization targets. ?*/
> ? if (sym->attr.flavor == FL_PROCEDURE)
> ? ? {
> - ? ? ?decl = gfc_get_extern_function_decl (sym);
> - ? ? ?gfc_set_decl_location (decl, &sym->declared_at);
> + ? ? ?if (sym->attr.external || sym->attr.use_assoc)
> + ? ? ? {
> + ? ? ? ? decl = gfc_get_extern_function_decl (sym);
> + ? ? ? ? gfc_set_decl_location (decl, &sym->declared_at);
> + ? ? ? }
> + ? ? ?else
> + ? ? ? {
> + ? ? ? ? if (!sym->backend_decl)
> + ? ? ? ? ? build_function_decl (sym, false);
> + ? ? ? ? decl = sym->backend_decl;
> + ? ? ? }
> ? ? ? return decl;
> ? ? }


Ok, here I forgot to check for attr.intrinsic. It should be

+      if (sym->attr.external || sym->attr.use_assoc || sym->attr.intrinsic)

With that change the patch regtests fine. I also changed 0/1 to false/true.

Cheers,
Janus

Attachment: vtab_init_v3.diff
Description: Binary data


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