[Bug fortran/53655] [OOP] CLASS-related warnings: "__copy" defined but not used; "default initializer" warnings

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 13 09:18:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53655

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |burnus at gcc dot gnu.org
            Summary|[]                          |[OOP] CLASS-related
                   |                            |warnings: "__copy" defined
                   |                            |but not used; "default
                   |                            |initializer" warnings

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-13 09:18:40 UTC ---
The following code has several warning issues:

a) For foo's "x" there is the warning:
"Derived-type dummy argument 'x' at (1) was declared INTENT(OUT) but was not
set and does not have a default initializer"
As "t" has no components, the warning doesn't make sense.

b) For bar's "x" there is no warning as it is sym->attr.referenced, but I think
one should warn that the "declared type" does not have an initializer.
(I think sym->attr.referenced gets set for "allocatable" dummies, thus, no
warning is printed.)

c) One gets the bogus error:
  warning: ‘__copy_MAIN___T2’ defined but not used [-Wunused-function]
It probably should be marked as DECL_ARTIFICIAL().


type t
end type t

type t2
  integer :: i
end type t2
contains
  subroutine foo(x)
    type(t), intent(out) :: x
  end subroutine foo

  subroutine bar(x)
    class(t2), intent(out) :: x
  end subroutine bar
end



More information about the Gcc-bugs mailing list