aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/array_constructor_type_6.f03
blob: df784f872bad68f5eac2a81cec5847696efde975 (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
! { dg-do run }
! { dg-options "-fbounds-check" }
!
! PR fortran/27997
!
! Array constructor with typespec.
!
program test
  character(15) :: a(3)
  character(10), volatile :: b(3)
  b(1) = 'Takata'
  b(2) = 'Tanaka'
  b(3) = 'Hayashi'

  a =  (/ character(len=7) :: trim(b(1)), trim(b(2)), trim(b(3)) /)
  if (a(1) /= 'Takata' .or. a(2) /= 'Tanaka' .or. a(3) /= 'Hayashi') then
    call abort ()
  end if

  a =  (/ character(len=2) :: trim(b(1)), trim(b(2)), trim(b(3)) /)
  if (a(1) /= 'Ta' .or. a(2) /= 'Ta' .or. a(3) /= 'Ha') then
    call abort ()
  end if

  a =  (/ character(len=8) :: trim(b(1)), trim(b(2)), trim(b(3)) /)
  if (a(1) /= 'Takata' .or. a(2) /= 'Tanaka' .or. a(3) /= 'Hayashi') then
    call abort ()
  end if

end program test