aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/vector_subscript_7.f90
blob: ddc813904b7cb9953ab1acfc1f7f66f86537fb90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
! { dg-do compile }
! PR 58009 - If a vector subscript has two or more elements with the
! same value, an array section with that vector subscript
! shall not appear in a variable definition context.

program main
  real, dimension(4) :: a,b
  real, dimension(1,4) :: c
  read (*,*) a([1,2,3,2]),i ! { dg-error "Elements with the same value" }
  read (*,*) c(1,[1,2,3,2]),i ! { dg-error "Elements with the same value" }
  b([1+i,1,i+1,2]) = a      ! { dg-error "Elements with the same value" }
  c(1,[1+i,1,i+1,2]) = a    ! { dg-error "Elements with the same value" }
  call foo (a([4,2,1,1]))   ! { dg-error "Elements with the same value" }
  call foo (c(1,[4,2,1,1])) ! { dg-error "Elements with the same value" }
  print *,a,b
contains
  subroutine foo(arg)
    real, intent(inout) :: arg(:)
    arg = arg + 1
  end subroutine foo 
end program main