http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52029
Bug #: 52029 Summary: [OOP] _copy should be PURE Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: missed-optimization, rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org The _copy procedure should be PURE. First, it is pure (which should help with optimization). Secondly, it avoids an error for: ! Contained procedure '__copy_foo_T' of a PURE procedure must also be PURE elemental subroutine foo() type t end type t class(t), allocatable :: x if (allocated(x)) i = 5 end Draft patch: --- class.c (Revision 183667) +++ class.c @@ -717,0 +718 @@ gfc_find_derived_vtab (gfc_symbol *deriv + copy->attr.pure = 1;