summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/dec_structure_6.f90
blob: 6494d71fd1ca13a24f2a62ef82da2ccfe2845299 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
! { dg-do run }
! { dg-options "-fdec-structure" }
!
! Test old-style CLIST initializers in STRUCTURE.
!

subroutine aborts (s)
  character(*), intent(in) :: s
  print *, s
  call abort()
end subroutine

integer, parameter :: as = 3
structure /s8/
  character*20 c /"HELLO"/  ! ok
  integer*2 j /300_4/       ! ok, converted
  integer   k /65536_8/     ! ok, implicit
  integer*4 l /200000/      ! ok, types match
  integer   m(5) /5,4,3,2,1/! ok
  integer   n(5) /1,3*2,1/  ! ok, with repeat spec (/1,2,2,2,1/)
  integer   o(as) /as*9/    ! ok, parameter array spec
  integer   p(2,2) /1,2,3,4/! ok
  real      q(3) /1_2,3.5,2.4E-12_8/ ! ok, with some implicit conversions
  integer :: canary = z'3D3D3D3D'
end structure

record /s8/ r8

! Old-style (clist) initializers in structures
if ( r8.c /= "HELLO" ) call aborts ("r8.c")
if ( r8.j /= 300 ) call aborts ("r8.j")
if ( r8.k /= 65536 ) call aborts ("r8.k")
if ( r8.l /= 200000 ) call aborts ("r8.l")
if (     r8.m(1) /= 5 .or. r8.m(2) /= 4 .or. r8.m(3) /= 3 &
    .or. r8.m(4) /= 2 .or. r8.m(5) /= 1) &
  call aborts ("r8.m")
if (     r8.n(1) /= 1 .or. r8.n(2) /= 2 .or. r8.n(3) /= 2 .or. r8.n(4) /= 2 &
    .or. r8.n(5) /= 1) &
  call aborts ("r8.n")
if ( r8.o(1) /= 9 .or. r8.o(2) /= 9 .or. r8.o(3) /= 9 ) call aborts ("r8.o")
if (     r8.p(1,1) /= 1 .or. r8.p(2,1) /= 2 .or. r8.p(1,2) /= 3 &
    .or. r8.p(2,2) /= 4) &
  call aborts ("r8.p")
if ( r8.canary /= z'3D3D3D3D' ) call aborts ("r8.canary")

end