summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/interface_46.f90
blob: c1d87638fbed25054199d9042ea3375fc3901806 (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
27
28
29
30
31
32
33
34
35
36
! { dg-do compile }
! PR 94090 - this used to cause an ICE.
!  Test case by José Rui Faustino de Sousa.
function cntf(a) result(s)
  implicit none

  integer, intent(in) :: a(:)
  
  integer :: s(3)
  
  s = [1, 2, 3]
  return
end function cntf

program ice_p

  implicit none

  interface
    function cntf(a) result(s)  ! { dg-error "Rank mismatch in function result" }
      implicit none
      integer, intent(in) :: a(:)
      integer             :: s ! (3) <- Ups!
    end function cntf
  end interface

  integer, parameter :: n = 9

  integer :: arr(n)
  
  integer :: s(3)

  s = cntf(arr)
  stop

end program ice_p