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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
!
3
! Tests fix for PR28425 in which anything other than a constructor would
4
! not work for derived type components in a structure constructor.
5
!
6
! Original version sent by Vivek Rao on 18 Jan 06
7
! Modified by Steve Kargl to remove IO
8
!
9
module foo_mod
10
 
11
  implicit none
12
 
13
  type :: date_m
14
     integer :: month
15
  end type date_m
16
 
17
  type :: file_info
18
     type(date_m) :: date
19
  end type file_info
20
 
21
end module foo_mod
22
 
23
program prog
24
 
25
  use foo_mod
26
 
27
  implicit none
28
  type(date_m)  :: dat
29
  type(file_info) :: xx
30
 
31
  type(date_m), parameter :: christmas = date_m (12)
32
 
33
  dat = date_m(1)
34
 
35
  xx = file_info(date_m(-1))  ! This always worked - a constructor
36
  if (xx%date%month /= -1) call abort
37
 
38
  xx = file_info(dat)         ! This was the original PR - a variable
39
  if (xx%date%month /= 1) call abort
40
 
41
  xx = file_info(foo(2))      ! ...functions were also broken
42
  if (xx%date%month /= 2) call abort
43
 
44
  xx = file_info(christmas)   ! ...and parameters
45
  if (xx%date%month /= 12) call abort
46
 
47
 
48
contains
49
 
50
  function foo (i) result (ans)
51
     integer :: i
52
     type(date_m) :: ans
53
     ans = date_m(i)
54
  end function foo
55
 
56
end program prog
57
! { dg-final { cleanup-modules "foo_mod" } }

powered by: WebSVN 2.1.0

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