http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58644
Bug ID: 58644 Summary: [OOP] Missing .data ref in passing a CLASS array as actual argument to a TYPE. Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Found while looking at the dump. The code seems to work at run time on all targets. Looking at gfortran.dg/class_to_type_2.f90, one has: function g () result(res) class(foo), allocatable :: res(:) allocate (res(3)) res(:)%i = 55 end function g subroutine subpr2_array (x) type(foo) :: x(:) if (any(x(:)%i /= 55)) call abort () end subroutine call subpr2_array (g ()) For that one gets the dump: struct __class_mod_subpr_Foo_1_0a D.2108; D.2108 = g (); subpr2_array (&D.2108); I believe that should be instead: subpr2_array (&D.2108.data); As D.2108 is not a pointer and .data is the first field, it seems to work, though.