1! { dg-do compile }
2! Test the fix for PR40158, where the errro message was not clear about scalars.
3!
4! Contributed by Tobias Burnus  <burnus@gcc.gnu.org>
5!
6  implicit none
7  integer :: i(4,5),j
8  i = 0
9  call sub1(i)
10  call sub1(j)  ! { dg-error "rank-1 and scalar" }
11  call sub2(i)  ! { dg-error "scalar and rank-2" }
12  call sub2(j)
13  print '(5i0)', i
14contains
15  subroutine sub1(i1)
16    integer :: i1(*)
17    i1(1) = 2
18  end subroutine sub1
19  subroutine sub2(i2)
20    integer :: i2
21    i2 = 2
22  end subroutine sub2
23end
24