Bug 71023 - Problem with associate and function returning derived type
Summary: Problem with associate and function returning derived type
Status: RESOLVED DUPLICATE of bug 60483
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-09 13:44 UTC by mrestelli
Modified: 2016-05-09 14:22 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mrestelli 2016-05-09 13:44:34 UTC
gfortran does not compile the following valid code:


module m
 implicit none

 type :: t
  integer :: i
 end type t

contains

 pure function make_a_t(i) result(at)
  integer, intent(in) :: i
  type(t) :: at
   at%i = i
 end function make_a_t

 subroutine s()

  associate( my_t => make_a_t(5) )

  write(*,*) my_t%i

  end associate

 end subroutine s

end module m



$ gfortran -c asb.f90 -o asb.o
asb.f90:20:18:

   write(*,*) my_t%i
                  1
Error: Symbol »my_t« at (1) has no IMPLICIT type

$ gfortran --version
GNU Fortran (GCC) 7.0.0 20160422 (experimental)
Comment 1 Dominique d'Humieres 2016-05-09 14:22:24 UTC
I think it is a duplicate of pr60483.

*** This bug has been marked as a duplicate of bug 60483 ***