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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! { dg-options "-fdefault-integer-8" }
3
! Tests the fix for PR34143, in which the implicit conversion of yy, with
4
! fdefault-integer-8, would cause a segfault at runtime.
5
!
6
! Contributed by Thomas Koenig 
7
!
8
Program test_constructor
9
    implicit none
10
    type :: thytype
11
        integer(4) :: a(2,2)
12
    end type thytype
13
    type :: mytype
14
        integer(4), allocatable :: a(:, :)
15
        type(thytype), allocatable :: q(:)
16
    end type mytype
17
    integer, allocatable :: yy(:,:)
18
    type (thytype), allocatable :: bar(:)
19
    type (mytype) :: x, y
20
    x = mytype(yy, bar)
21
    if (allocated (x%a) .or. allocated (x%q)) call abort
22
    allocate (yy(2,2))
23
    allocate (bar(2))
24
    yy = reshape ([10,20,30,40],[2,2])
25
    bar = thytype (reshape ([1,2,3,4],[2,2]))
26
    ! Check that unallocated allocatables work
27
    y = mytype(yy, bar)
28
    if (.not.allocated (y%a) .or. .not.allocated (y%q)) call abort
29
end program test_constructor

powered by: WebSVN 2.1.0

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