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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! This checks the correct functioning of derived types with the SAVE
3
! attribute and allocatable components - PR31163
4
!
5
! Contributed by Salvatore Filippone  
6
!
7
Module bar_mod
8
 
9
  type foo_type
10
     integer, allocatable :: mv(:)
11
  end type foo_type
12
 
13
 
14
contains
15
 
16
 
17
  subroutine bar_foo_ab(info)
18
 
19
    integer, intent(out)               :: info
20
    Type(foo_type), save :: f_a
21
 
22
    if (allocated(f_a%mv)) then
23
      info = size(f_a%mv)
24
    else
25
      allocate(f_a%mv(10),stat=info)
26
      if (info /= 0) then
27
        info = -1
28
      endif
29
    end if
30
  end subroutine bar_foo_ab
31
 
32
 
33
end module bar_mod
34
 
35
program tsave
36
  use bar_mod
37
 
38
  integer :: info
39
 
40
  call bar_foo_ab(info)
41
  if (info .ne. 0) call abort ()
42
  call bar_foo_ab(info)
43
  if (info .ne. 10) call abort ()
44
 
45
end program tsave
46
 
47
! { dg-final { cleanup-modules "bar_mod" } }

powered by: WebSVN 2.1.0

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