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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [string_ctor_1.f90] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! Program to test character array constructors.
3
! PR17144
4
subroutine test1 (n, t, u)
5
  integer n
6
  character(len=n) :: s(2)
7
  character(len=*) :: t
8
  character(len=*) :: u
9
 
10
  ! A variable array constructor.
11
  s = (/t, u/)
12
  ! An array constructor as part of an expression.
13
  if (any (s .ne. (/"Hell", "Worl"/))) call abort
14
end subroutine
15
 
16
subroutine test2
17
  character*5 :: s(2)
18
 
19
  ! A constant array constructor
20
  s = (/"Hello", "World"/)
21
  if ((s(1) .ne. "Hello") .or. (s(2) .ne. "World")) call abort
22
end subroutine
23
 
24
subroutine test3
25
  character*1 s(26)
26
  character*26 t
27
  integer i
28
 
29
  ! A large array constructor
30
  s = (/'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', &
31
        'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'/)
32
  do i=1, 26
33
    t(i:i) = s(i)
34
  end do
35
 
36
  ! Assignment with dependency
37
  s = (/(s(27-i), i=1, 26)/)
38
  do i=1, 26
39
    t(i:i) = s(i)
40
  end do
41
  if (t .ne. "zyxwvutsrqponmlkjihgfedcba") call abort
42
end subroutine
43
 
44
program string_ctor_1
45
  call test1 (4, "Hello", "World")
46
  call test2
47
  call test3
48
end program
49
 

powered by: WebSVN 2.1.0

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