This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/52029] New: [OOP] _copy should be PURE


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: unassigned@gcc.gnu.org
        ReportedBy: burnus@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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]