summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/use_12.f90
blob: 7406dc433886ebe013a605a6b0940570c19b6893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
! { dg-do compile }
! { dg-options "-Wreturn-type" }
! Tests the fix of PR34545, in which the 'numclusters' that determines the size
! of fnres was not properly associated.
!
! Reported by Jon D. Richards <jon_d_r@msn.com>
!
module m1
  integer :: numclusters = 2
end module m1

module m2
  contains
    function get_nfirst( ) result(fnres)  ! { dg-warning "not set" }
      use m1, only: numclusters
      real :: fnres(numclusters)   ! change to REAL and it works!!  
    end function get_nfirst
end module m2

program kmeans_driver
   use m1
   use m2
   integer :: nfirst(3)
   nfirst(1:numclusters) = get_nfirst( )
end program kmeans_driver
! { dg-final { cleanup-modules "m1 m2" } }