comparison gcc/testsuite/gfortran.dg/restricted_expression_3.f90 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ! { dg-do compile }
2
3 ! PR fortran/35723
4 ! Check that a dummy-argument array with non-restricted subscript is
5 ! rejected and some more reference-checks.
6
7 PROGRAM main
8 IMPLICIT NONE
9 CALL test (5, (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), "0123456789" )
10
11 CONTAINS
12
13 SUBROUTINE test (n, arr, str)
14 IMPLICIT NONE
15 INTEGER :: n, arr(:)
16 CHARACTER(len=10) :: str
17
18 INTEGER :: i = 5
19 INTEGER :: ok1(arr(n)), ok2(LEN_TRIM (str(3:n)))
20 INTEGER :: ok3(LEN_TRIM("hello, world!"(2:n)))
21 INTEGER :: wrong1(arr(i)) ! { dg-error "'i' cannot appear" }
22 INTEGER :: wrong2(LEN_TRIM (str(i:n))) ! { dg-error "'i' cannot appear" }
23 INTEGER :: wrong3(LEN_TRIM ("hello, world!"(i:n))) ! { dg-error "'i' cannot appear" }
24 END SUBROUTINE test
25
26 END PROGRAM main