[Patch, fortran] PR81447 - [7/8] gfortran fails to recognize the exact dynamic type of a polymorphic entity that was allocated in a external procedure

Andre Vehreschild vehre@gmx.de
Sat Nov 4 18:03:00 GMT 2017


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 



More information about the Gcc-patches mailing list