aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/use_12.f90
blob: 9a0c78c12c5e9923eab796dd4c30afe67cd9bd25 (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
! { 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