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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! Like char_result_3.f90, but the array arguments are pointers.
2
! { dg-do run }
3
pure elemental function double (x)
4
  integer, intent (in) :: x
5
  integer :: double
6
  double = x * 2
7
end function double
8
 
9
program main
10
  implicit none
11
 
12
  interface
13
    pure elemental function double (x)
14
      integer, intent (in) :: x
15
      integer :: double
16
    end function double
17
  end interface
18
 
19
  integer, dimension (100:104), target :: a
20
  integer, dimension (:), pointer :: ap
21
  integer :: i, lower
22
 
23
  a = (/ (i + 5, i = 0, 4) /)
24
  ap => a
25
  lower = lbound(a,dim=1)
26
 
27
  call test (f1 (ap), 35)
28
  call test (f2 (ap), 115)
29
  call test (f3 (ap), 60)
30
  call test (f4 (ap, 104, 2), 21)
31
contains
32
  function f1 (array)
33
    integer, dimension (:), pointer :: array
34
    character (len = sum (array)) :: f1
35
    f1 = ''
36
  end function f1
37
 
38
  function f2 (array)
39
    integer, dimension (:), pointer :: array
40
    character (len = array (101) + a (104) + 100) :: f2
41
    f2 = ''
42
  end function f2
43
 
44
  function f3 (array)
45
    integer, dimension (:), pointer :: array
46
    character (len = sum (double (array (101:)))) :: f3
47
    f3 = ''
48
  end function f3
49
 
50
  function f4 (array, upper, stride)
51
    integer, dimension (:), pointer :: array
52
    integer :: upper, stride
53
    character (len = sum (array (lower:upper:stride))) :: f4
54
    f4 = ''
55
  end function f4
56
 
57
  subroutine test (string, length)
58
    character (len = *) :: string
59
    integer, intent (in) :: length
60
    if (len (string) .ne. length) call abort
61
  end subroutine test
62
end program main

powered by: WebSVN 2.1.0

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