aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/used_before_typed_4.f90
blob: ff8a1fc2970e69753b33f1567c28e40d4cf7153e (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
! { dg-do compile }
! { dg-options "-std=f95" }

! Test for a special case of the used-before-typed errors, when the symbols
! not-yet-typed are indices.

SUBROUTINE test (n, arr1, m, arr2) ! { dg-error "has no IMPLICIT type" }
  IMPLICIT NONE

  INTEGER :: myarr(42)

  INTEGER :: arr1(SIZE (myarr(1:n))) ! { dg-error "'n' is used before" }
  INTEGER :: n

  INTEGER :: arr2(LEN ("hello"(1:m))) ! { dg-error "'m' is used before" }
  INTEGER :: m

  WRITE (*,*) SIZE (arr1)
  WRITE (*,*) SIZE (arr2)
END SUBROUTINE test

PROGRAM main
  IMPLICIT NONE
  INTEGER :: arr1(42), arr2(42)
  CALL test (3, arr1, 2, arr2) ! { dg-warning "Type mismatch in argument" }
END PROGRAM main