http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46313
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org 2010-11-05 15:46:10 UTC --- With r166360, I do not see the (a) problem. Are you using a clean source tree or do you have local changes? For the first code, I see troutmask:sgk[209] gfc4x -o z tr.f90 tr.f90:20.17: allocate ( t2 :: b1) 1 Error: Type of entity at (1) is type incompatible with typespec tr.f90:27.13: print *, b2%b 1 Error: 'b' at (1) is not a member of the 'mytype' structure I'll also note that your (b) workaround fails with troutmask:sgk[240] gfc4x -o z tr.f90 tr.f90:27.13: print *, b2%b 1 Error: 'b' at (1) is not a member of the 'mytype' structure tr.f90:20.10-21: allocate (b1, source=t2()) 1 2 Error: Type of entity at (1) is type incompatible with source-expr at (2) -fdump-parse-tree suggests that the parsing of class(t2) :: b1, b2 is not picking up the renamed type. Namespace: A-Z: (UNKNOWN 0) procedure name = MAIN__ symtree: 'MAIN__' || symbol: 'MAIN__' type spec : (UNKNOWN 0) attributes: (PROGRAM PUBLIC SUBROUTINE) symtree: 'a1' || symbol: 'a1' type spec : (CLASS class$mytype_a) attributes: (VARIABLE ) value: class$mytype_a(NULL() , ()) symtree: 'a2' || symbol: 'a2' type spec : (CLASS class$mytype_a) attributes: (VARIABLE ) value: class$mytype_a(NULL() , ()) symtree: 'b1' || symbol: 'b1' type spec : (CLASS class$mytype_a) attributes: (VARIABLE ) value: class$mytype_a(NULL() , ()) symtree: 'b2' || symbol: 'b2' type spec : (CLASS class$mytype_a) attributes: (VARIABLE ) value: class$mytype_a(NULL() , ()) symtree: 'class$mytype_a'|| symbol: 'class$mytype_a' type spec : (UNKNOWN 0) attributes: (DERIVED ) components: ($data (DERIVED mytype) () PRIVATE) ($vptr (DERIVED vtype$mytype) POINTER () PRIVATE) Procedure bindings: Operator bindings: symtree: 'def_init$mytype'|| symbol: 'def_init$mytype' type spec : (DERIVED mytype) attributes: (VARIABLE PUBLIC EXPLICIT-SAVE TARGET) value: mytype(2.00000000) symtree: 'm1' || symbol: 'm1' type spec : (UNKNOWN 0) attributes: (MODULE USE-ASSOC(m1)) symtree: 'm2' || symbol: 'm2' type spec : (UNKNOWN 0) attributes: (MODULE USE-ASSOC(m2)) symtree: 't1' || symbol: 'mytype' type spec : (UNKNOWN 0) attributes: (DERIVED USE-ASSOC(m1)) components: (a (REAL 4) DIMENSION (1 [0] AS_EXPLICIT 1 10 )) hash: 22483813 Procedure bindings: Operator bindings: symtree: 't2' || symbol: 'mytype' type spec : (UNKNOWN 0) attributes: (DERIVED USE-ASSOC(m2)) components: (b (REAL 4) DIMENSION (1 [0] AS_EXPLICIT 1 10 )) hash: 58329636 Procedure bindings: Operator bindings: symtree: 'vtab$mytype' || symbol: 'vtab$mytype' type spec : (DERIVED vtype$mytype) attributes: (VARIABLE PUBLIC EXPLICIT-SAVE TARGET) value: vtype$mytype(22483813 , 0 , NULL() , MAIN__:def_init$mytype) symtree: 'vtype$mytype'|| symbol: 'vtype$mytype' type spec : (UNKNOWN 0) attributes: (DERIVED PUBLIC ) components: ($hash (INTEGER 4) () PRIVATE) ($size (INTEGER 4) () PRIVATE) ($extends (DERIVED vtype$mytype) POINTER () PRIVATE) ($def_init (DERIVED mytype) POINTER () PRIVATE) code: ALLOCATE MAIN__:a1 ALLOCATE MAIN__:b1 ALLOCATE MAIN__:a2 ALLOCATE MAIN__:b2 WRITE UNIT=6 FMT=-1 TRANSFER MAIN__:a2 % a(FULL) DT_END Finally, note that if you rename mytype in either module to something unique, then the code compiles.