[Bug fortran/47767] [OOP] SELECT TYPE fails to execute correct TYPE IS block
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 16 18:38:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47767
--- Comment #1 from janus at gcc dot gnu.org 2011-02-16 18:31:06 UTC ---
Here is a variant: Apart from SELECT TYPE, this bug can also be exposed via the
SAME_TYPE_AS intrinsic.
module Tree_Nodes
type treeNode
contains
procedure :: walk
end type
contains
subroutine walk (thisNode)
class (treeNode) :: thisNode
print *, SAME_TYPE_AS (thisNode, treeNode())
end subroutine
end module
module Merger_Trees
use Tree_Nodes
private
public :: mergerTree
type mergerTree
type(treeNode), pointer :: baseNode
end type
end module
module Merger_Tree_Build
use Merger_Trees
end module
program test
use Merger_Tree_Build
use Tree_Nodes
type(treeNode) :: node
call walk (node)
end program
This prints "F", but should print "T".
The underlying problem seems to be related to the vtable not being properly set
up. The vtab symbol for the type 'treeNode' apparently is present, but it is
not initialized properly: The '_hash' component is 0!
Looking at the mod files, the symbol '__vtab_tree_nodes_Treenode' seems to be
present in tree_nodes.mod and merger_tree_build.mod, but not in
merger_trees.mod!
More information about the Gcc-bugs
mailing list