http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45586
--- Comment #79 from rguenther at suse dot de <rguenther at suse dot de> 2012-08-01 15:05:22 UTC --- On Wed, 1 Aug 2012, mikael at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45586 > > --- Comment #78 from Mikael Morin <mikael at gcc dot gnu.org> 2012-08-01 > 15:01:59 UTC --- > (In reply to comment #76) > > You mean > > > > [...] > > > > ? Yes, that also should be build_distinct_type_copy. > > > Even without that, the patch regtests cleanly (including the pr45586 tests), > apart for typebound_proc_20.f90. That one fail in the following line from the > `calc' subroutine: > > this%y = this%find_y() ! FAILS > > the lhs is a target, and the rhs is NOT a target, so that the middle-end types > are different. :-( But how can this be a valid fortran program? You assign something that is not aliased to something that suddenly makes it aliased? If that's valid then you can make the middle-end happy by wrapping the RHS inside a VIEW_CONVERT_EXPR with the LHS type.