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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [ret_pointer_2.f90] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
! { dg-do run }
! { dg-do run }
! PR 25806: Functions returning pointers to arrays
! PR 25806: Functions returning pointers to arrays
program a
program a
    integer, target :: storage(5)
    integer, target :: storage(5)
    integer :: s(3)
    integer :: s(3)
    print *, x(3)  ! { dg-output " *1  *2  *3" }
    print *, x(3)  ! { dg-output " *1  *2  *3" }
    if (ssum(x(3)) /= 6) call abort()
    if (ssum(x(3)) /= 6) call abort()
    s = 0
    s = 0
    s = x(3)
    s = x(3)
    if (any(s /= (/1, 2, 3/))) call abort()
    if (any(s /= (/1, 2, 3/))) call abort()
contains
contains
    function x(n) result(t)
    function x(n) result(t)
        integer, intent(in) :: n
        integer, intent(in) :: n
        integer, pointer :: t(:)
        integer, pointer :: t(:)
        integer :: i
        integer :: i
        t => storage(1:n)
        t => storage(1:n)
        t = (/ (i, i = 1, n) /)
        t = (/ (i, i = 1, n) /)
    end function x
    end function x
    integer function ssum(a)
    integer function ssum(a)
        integer, intent(in) :: a(:)
        integer, intent(in) :: a(:)
        ssum = sum(a)
        ssum = sum(a)
    end function ssum
    end function ssum
end program a
end program a
 
 

powered by: WebSVN 2.1.0

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