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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! Structure constructor with default initialization.
3
 
4
PROGRAM test
5
  IMPLICIT NONE
6
 
7
  ! Type with all default values
8
  TYPE :: quasiempty_t
9
    CHARACTER(len=5) :: greeting = "hello"
10
  END TYPE quasiempty_t
11
 
12
  ! Structure of basic data types
13
  TYPE :: basics_t
14
    INTEGER :: i = 42
15
    REAL :: r
16
    COMPLEX :: c = (0., 1.)
17
  END TYPE basics_t
18
 
19
  TYPE(quasiempty_t) :: empty
20
  TYPE(basics_t) :: basics
21
 
22
  empty = quasiempty_t ()
23
  IF (empty%greeting /= "hello") THEN
24
    CALL abort()
25
  END IF
26
 
27
  basics = basics_t (r = 1.5)
28
  IF (basics%i /= 42 .OR. basics%r /= 1.5 .OR. basics%c /= (0., 1.)) THEN
29
    CALL abort()
30
  END IF
31
 
32
  basics%c = (0., 0.) ! So we see it's surely gotten re-initialized
33
  basics = basics_t (1, 5.1)
34
  IF (basics%i /= 1 .OR. basics%r /= 5.1 .OR. basics%c /= (0., 1.)) THEN
35
    CALL abort()
36
  END IF
37
 
38
END PROGRAM test

powered by: WebSVN 2.1.0

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