2012/6/2 Tobias Burnus <bur...@net-b.de>: > Alessandro Fanfarillo wrote: >> >> The gfortran.dg/dynamic_dispatch_4.f03 had this problem in the past >> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43986); currently it >> calls the __free_s_bar_mod_S_bar function instead of the proper >> doit(). > > > That kind of makes sense: "foo" has no allocatable components while "s_bar" > has. Seemingly, "foo" has no "_free" component - and thus, the first entry > in "vtab" after _hash, _size, _extends, _def_init and _copy is "doit". > However, s_bar has at that position not "doit" but "_free".
Right, the problem is that the _free component is missing. Just as the _copy component, _free should be present for *every* vtype, no matter if there are allocatable components or not. If the _free component is not needed, it should be initialized to EXPR_NULL. Cheers, Janus