c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / vector_subscript_7.f90
blobddc813904b7cb9953ab1acfc1f7f66f86537fb90
1 ! { dg-do compile }
2 ! PR 58009 - If a vector subscript has two or more elements with the
3 ! same value, an array section with that vector subscript
4 ! shall not appear in a variable definition context.
6 program main
7 real, dimension(4) :: a,b
8 real, dimension(1,4) :: c
9 read (*,*) a([1,2,3,2]),i ! { dg-error "Elements with the same value" }
10 read (*,*) c(1,[1,2,3,2]),i ! { dg-error "Elements with the same value" }
11 b([1+i,1,i+1,2]) = a ! { dg-error "Elements with the same value" }
12 c(1,[1+i,1,i+1,2]) = a ! { dg-error "Elements with the same value" }
13 call foo (a([4,2,1,1])) ! { dg-error "Elements with the same value" }
14 call foo (c(1,[4,2,1,1])) ! { dg-error "Elements with the same value" }
15 print *,a,b
16 contains
17 subroutine foo(arg)
18 real, intent(inout) :: arg(:)
19 arg = arg + 1
20 end subroutine foo
21 end program main