URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [der_init.f90] - Rev 318
Go to most recent revision | Compare with Previous | Blame | View Log
! Program to test derived type initializers and constructors
program der_init
implicit none
type t
integer :: i
integer :: j = 4
end type
integer :: m, n
! Explicit initializer
type (t) :: var = t(1, 2)
! Type (default) initializer
type (t) :: var2
! Initialization of arrays
type (t), dimension(2) :: var3
type (t), dimension(2) :: var4 = (/t(7, 9), t(8, 6)/)
if (var%i .ne. 1 .or. var%j .ne. 2) call abort
if (var2%j .ne. 4) call abort
var2 = t(6, 5)
if (var2%i .ne. 6 .or. var2%j .ne. 5) call abort
if ((var3(1)%j .ne. 4) .or. (var3(2)%j .ne. 4)) call abort
if ((var4(1)%i .ne. 7) .or. (var4(2)%i .ne. 8) &
.or. (var4(1)%j .ne. 9) .or. (var4(2)%j .ne. 6)) call abort
! Non-constant constructor
n = 1
m = 5
var2 = t(n, n + m)
if (var2%i .ne. 1 .or. var2%j .ne. 6) call abort
end program
Go to most recent revision | Compare with Previous | Blame | View Log