[Bug fortran/33334] User-defined type as function result: use-assocciated not accepted

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Sep 8 08:10:00 GMT 2007



------- Comment #1 from burnus at gcc dot gnu dot org  2007-09-08 08:09 -------
This probably needs the same technique as PR31229 / PR31154.

The following program is valid, but rejected by gfortran (also if one does not
rename the symbol):

  func%i = 5
     1
Error: Derived type 'z' at (1) is being used before it is defined
a.f90:7.21:

type(z) function func()
                    1
Error: The derived type 'func' at (1) is of type 'z', which has not been
defined


module x
 type t
   integer :: i
 end type t
end module x

type(z) function func()
  use x, only: z=>t
  func%i = 5
end function func


This program is accepted by NAG f95, g95, ifort, openf95 and sunf95.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
           Keywords|                            |rejects-valid
            Summary|User-defined type as        |User-defined type as
                   |function result in an       |function result: use-
                   |interface: Accepts invalid  |assocciated not accepted


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



More information about the Gcc-bugs mailing list