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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! PR 25217: INTENT(OUT) dummies of derived type with default initializers shall
3
! be (re)initialized upon procedure entry, unless they are ALLOCATABLE.
4
! Modified to take account of the regression, identified by Martin Tees
5
! http://gcc.gnu.org/ml/fortran/2006-08/msg00276.html and fixed with
6
! PR 28788.
7
module dt
8
    type :: drv
9
        integer :: a(3) = [ 1, 2, 3 ]
10
        character(3) :: s = "abc"
11
        real, pointer :: p => null()
12
    end type drv
13
end module dt
14
 
15
module subs
16
contains
17
    subroutine foo(fb)
18
        use dt
19
        type(drv), intent(out) :: fb
20
        call sub (fb)
21
    end subroutine foo
22
 
23
    subroutine sub(fa)
24
        use dt
25
        type(drv), intent(out) :: fa
26
 
27
        if (any(fa%a /= [ 1, 2, 3 ])) call abort()
28
        if (fa%s /= "abc") call abort()
29
        if (associated(fa%p)) call abort()
30
    end subroutine sub
31
end module subs
32
 
33
program main
34
    use dt
35
    use subs
36
    implicit none
37
    type(drv) :: aa
38
    type(drv), allocatable :: ab(:)
39
    real, target :: x = 99, y = 999
40
 
41
    aa = drv ([ 4, 5, 6], "def", x)
42
    call sub(aa)
43
 
44
    aa = drv ([ 7, 8, 9], "ghi", y)
45
    call foo(aa)
46
end program main
47
 
48
! { dg-final { cleanup-modules "dt subs" } }

powered by: WebSVN 2.1.0

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