[Bug fortran/84674] [7/8/9 Regression] Derived type name change makes a program segfault, removing non_overridable helps

albandil at atlas dot cz gcc-bugzilla@gcc.gnu.org
Sun Jul 29 19:57:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84674

--- Comment #3 from Jakub Benda <albandil at atlas dot cz> ---
Bisection points to revision 254427 from 5 November 2017, which adds this chunk
of code to "fortran/resolv.c" (function "resolve_fl_derived", lines
14081-14093):

  /* 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
      && 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);
    }

When I comment it out, the compiled program works as expected.


More information about the Gcc-bugs mailing list