OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [data_invalid.f90] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do compile }
2
! { dg-options "-std=f95 -fmax-errors=0" }
3
!
4
! Testcases from PR fortran/24978
5
!
6
 
7
SUBROUTINE data_init_scalar_invalid()
8
  integer :: a
9
  data       a / 1 /
10
  data       a / 1 /                             ! { dg-error "re-initialization" }
11
 
12
  integer :: b = 0
13
  data       b / 1 /                             ! { dg-error "re-initialization" }
14
END SUBROUTINE
15
 
16
SUBROUTINE data_init_array_invalid()
17
  ! initialize (at least) one element, re-initialize full array
18
  integer :: a(3)
19
  data       a(2) / 2 /
20
  data       a    / 3*1 /                        ! { dg-error "re-initialization" }
21
 
22
  ! initialize (at least) one element, re-initialize subsection including the element
23
  integer :: b(3)
24
  data       b(2)   / 2 /
25
  data       b(1:2) / 2*1 /                      ! { dg-error "re-initialization" }
26
 
27
  ! initialize subsection, re-initialize (intersecting) subsection
28
  integer :: c(3)
29
  data       c(1:2) / 2*1 /
30
  data       c(2:3) / 1,1 /                      ! { dg-error "re-initialization" }
31
 
32
  ! initialize subsection, re-initialize full array
33
  integer :: d(3)
34
  data       d(2:3) / 2*1 /
35
  data       d      / 2*2, 3 /                   ! { dg-error "re-initialization" }
36
 
37
  ! full array initializer, re-initialize (at least) one element
38
  integer :: e(3)
39
  data       e    / 3*1 /
40
  data       e(2) / 2 /                          ! { dg-error "re-initialization" }
41
 
42
  integer :: f(3) = 0                            ! { dg-error "already is initialized" }
43
  data       f(2) / 1 /
44
 
45
  ! full array initializer, re-initialize subsection
46
  integer :: g(3)
47
  data       g      / 3*1 /
48
  data       g(1:2) / 2*2 /                      ! { dg-error "re-initialization" }
49
 
50
  integer :: h(3) = 1                            ! { dg-error "already is initialized" }
51
  data       h(2:3) / 2*2 /
52
 
53
  ! full array initializer, re-initialize full array
54
  integer :: i(3)
55
  data       i   / 3*1 /
56
  data       i   / 2,2,2 /                       ! { dg-error "re-initialization" }
57
 
58
  integer :: j(3) = 1                            ! { dg-error "already is initialized" }
59
  data       j   / 3*2 /
60
END SUBROUTINE
61
 
62
SUBROUTINE data_init_matrix_invalid()
63
  ! initialize (at least) one element, re-initialize full matrix
64
  integer :: a(3,3)
65
  data       a(2,2) / 1 /
66
  data       a      / 9*2 /                      ! { dg-error "re-initialization" }
67
 
68
  ! initialize (at least) one element, re-initialize subsection
69
  integer :: b(3,3)
70
  data       b(2,2) / 1 /
71
  data       b(2,:) / 3*2 /                      ! { dg-error "re-initialization" }
72
 
73
  ! initialize subsection, re-initialize (intersecting) subsection
74
  integer :: c(3,3)
75
  data       c(3,:) / 3*1 /, c(:,3) / 3*2 /      ! { dg-error "re-initialization" }
76
 
77
  ! initialize subsection, re-initialize full array
78
  integer :: d(3,3)
79
  data       d(2,:) / 1,2,3 /
80
  data       d      / 9*4 /                      ! { dg-error "re-initialization" }
81
 
82
  ! full array initializer, re-initialize (at least) one element
83
  integer :: e(3,3)
84
  data       e      / 9*1 /
85
  data       e(2,3) / 2 /                        ! { dg-error "re-initialization" }
86
 
87
  integer :: f(3,3) = 1                          ! { dg-error "already is initialized" }
88
  data       f(3,2) / 2 /
89
 
90
  ! full array initializer, re-initialize subsection
91
  integer :: g(3,3)
92
  data       g          / 9 * 1 /
93
  data       g(2:3,2:3) / 2, 2*3, 4 /            ! { dg-error "re-initialization" }
94
 
95
  integer :: h(3,3) = 1                          ! { dg-error "already is initialized" }
96
  data       h(2:3,2:3) / 2, 2*3, 4 /
97
 
98
  ! full array initializer, re-initialize full array
99
  integer :: i(3,3)
100
  data       i   / 3*1, 3*2, 3*3 /
101
  data       i   / 9 * 1 /                       ! { dg-error "re-initialization" }
102
 
103
  integer :: j(3,3) = 0                          ! { dg-error "already is initialized" }
104
  data       j   / 9 * 1 /
105
END SUBROUTINE
106
 
107
SUBROUTINE data_init_misc_invalid()
108
  ! wrong number of dimensions
109
  integer :: a(3)
110
  data       a(1,1) / 1 /                        ! { dg-error "Rank mismatch" }
111
 
112
  ! index out-of-bounds, direct access
113
  integer :: b(3)
114
  data       b(-2) / 1 /                         ! { dg-error "below array lower bound" }
115
 
116
  ! index out-of-bounds, implied do-loop (PR32315)
117
  integer :: i
118
  character(len=20), dimension(4) :: string
119
  data (string(i), i = 1, 5) / 'A', 'B', 'C', 'D', 'E' /   ! { dg-error "above array upper bound" }
120
END SUBROUTINE
121
 
122
! { dg-excess-errors "" }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.