This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR81447 - [7/8] gfortran fails to recognize the exact dynamic type of a polymorphic entity that was allocated in a external procedure
- From: Andre Vehreschild <vehre at gmx dot de>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Date: Sat, 4 Nov 2017 19:03:39 +0100
- Subject: Re: [Patch, fortran] PR81447 - [7/8] gfortran fails to recognize the exact dynamic type of a polymorphic entity that was allocated in a external procedure
- Authentication-results: sourceware.org; auth=none
- References: <CAGkQGi+O8g1c_C3=WF8D=CMLN495rE84dO7LrWwUmcKKEaTSBw@mail.gmail.com> <CAGkQGiKzv6TzgvqwGNUAp_Czdwt-_UUgimUdL4QnyQGZntA6EQ@mail.gmail.com>
Hi Paul,
On Thu, 2 Nov 2017 20:11:29 +0000
Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:
> *************** resolve_fl_derived (gfc_symbol *sym)
> *** 14075,14080 ****
> --- 14078,14097 ----
> if (!resolve_typebound_procedures (sym))
> return false;
>
> + /* Generate module vtables subject to their accessibility and their not
> + being vtables or pdt templates. If this is not done class declarations
> + in external procedures wind up with their own version and so SELECT
> TYPE
> + fails because the vptrs do not have the same address. */
> + if (gfc_option.allow_std & GFC_STD_F2003
Shouldn't that better be
if ((gfc_option.allow_std & GFC_STD_F2003) > 0
? I regularly fall on my nose because of the compiler binding this not as
expected.
> + && sym->ns->proc_name
> + && sym->ns->proc_name->attr.flavor == FL_MODULE
> + && sym->attr.access != ACCESS_PRIVATE
> + && !(sym->attr.use_assoc || sym->attr.vtype ||
> sym->attr.pdt_template))
> + {
> + gfc_symbol *vtab = gfc_find_derived_vtab (sym);
> + gfc_set_sym_referenced (vtab);
> + }
> +
> return true;
> }
Besides that I think this is OK.
Regards,
Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de