111
|
1 ! { dg-do compile }
|
|
2 ! Tests the constraints in the patch for PR29642, which requested the
|
|
3 ! implementation of the F2003 VALUE attribute for gfortran.
|
|
4 !
|
|
5 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
|
|
6 !
|
|
7 program test_value
|
|
8 integer(8) :: i = 42, j ! { dg-error "not a dummy" }
|
|
9 integer(8), value :: k ! { dg-error "not a dummy" }
|
|
10 value :: j
|
|
11
|
|
12 contains
|
|
13 subroutine bar_1 (i)
|
|
14 integer(8) :: i
|
|
15 dimension i(8)
|
|
16 value :: i ! { dg-error "conflicts with DIMENSION" }
|
|
17 i = 0
|
|
18 end subroutine bar_1
|
|
19
|
|
20 subroutine bar_2 (i)
|
|
21 integer(8) :: i
|
|
22 pointer :: i
|
|
23 value :: i ! { dg-error "conflicts with POINTER" }
|
|
24 i = 0
|
|
25 end subroutine bar_2
|
|
26
|
|
27 integer function bar_3 (i)
|
|
28 integer(8) :: i
|
|
29 dimension i(8)
|
|
30 value :: bar_3 ! { dg-error "conflicts with FUNCTION" }
|
|
31 i = 0
|
|
32 bar_3 = 0
|
|
33 end function bar_3
|
|
34
|
|
35 subroutine bar_4 (i, j)
|
|
36 integer(8), intent(inout) :: i
|
|
37 integer(8), intent(out) :: j
|
|
38 value :: i ! { dg-error "conflicts with INTENT" }
|
|
39 value :: j ! { dg-error "conflicts with INTENT" }
|
|
40 i = 0
|
|
41 j = 0
|
|
42 end subroutine bar_4
|
|
43
|
|
44 integer function bar_5 ()
|
|
45 integer(8) :: i
|
|
46 external :: i
|
|
47 integer, parameter :: j = 99
|
|
48 value :: i ! { dg-error "conflicts with EXTERNAL" }
|
|
49 value :: j ! { dg-error "PARAMETER attribute conflicts with" }
|
|
50 bar_5 = 0
|
|
51 end function bar_5
|
|
52
|
|
53 end program test_value
|