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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gfortran.dg/] [func_derived_1.f90] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
! { dg-do run }
2
! PR 17244
3
! verifies that functions returning derived type work
4
module m
5
  type t
6
     integer i
7
     real x
8
     character*5 c
9
     integer arr(5,5)
10
  end type t
11
end module m
12
 
13
use m
14
type(t) :: r
15
integer arr(5,5), vect(25), vect2(25)
16
do i=1,25
17
   vect = 0
18
   vect(i) = i
19
   arr = reshape (vect, shape(arr))
20
   r = f(i,real(i),"HALLO",arr)
21
 
22
   if (r%i .ne. i) call abort()
23
   if (r%x .ne. real(i)) call abort()
24
   if (r%c .ne. "HALLO") call abort()
25
   vect2 = reshape (r%arr, shape(vect2))
26
   if (any(vect2.ne.vect)) call abort()
27
end do
28
contains
29
 
30
function f(i,x,c,arr)
31
  type(t) :: f
32
  character*5 c
33
  integer arr(5,5)
34
 
35
  f = t(i,x,c,arr)
36
end function f
37
 
38
end
39
 
40
! { dg-final { cleanup-modules "m" } }

powered by: WebSVN 2.1.0

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