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

[Bug fortran/41951] [OOP] ICE in gfc_match_varspec, at fortran/primary.c:1815


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41951

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-12 13:14:24 UTC ---
(In reply to comment #6)
> However, while the example of comment 2 (attachment 18978 [details]) compiles,
> it fails to link with:   undefined reference to `assign_'

The problem is in "subroutine bsort(a,tmp)": The line
    tmp = a(i)
should call tmp->_vtr->assign. However, it calls a simple external "assign"
procedure. If one uses:
    call tmp%assign(a(i))
one finds the correct dump, namely:
    tmp->_vptr->assign ((struct __class_m_sort_Sort_t *) tmp, &class.2);


The "assign" is found when resolve_ordinary_assign calls gfc_extend_assign,
which runs:
  3452    sym = gfc_search_interface (ns->op[INTRINSIC_ASSIGN], 1, &actual);

That returns the INTERFACE instead of the type bound procedure:

(gdb) p sym->name
$9 = 0x2aaaacde8fd0 "assign"
(gdb) p sym->attr.external
$11 = 1

If one changes the interface to an abstract one, one gets 
   ERROR: ABSTRACT INTERFACE 'assign' must not be referenced


Using "assign" instead of the type-bound "assign" is definitely a bug as no 
"INTERFACE ASSIGNMENT(=)" exists - there is only the type-based "generic ::
assignment(=) => assign".


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