OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.dg/] [alloc_comp_result_1.f90] - Blame information for rev 437

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

Line No. Rev Author Line
1 302 jeremybenn
! { dg-do run }
2
! Test the fix for PR38802, in which the nulling of the result 'p'
3
! in 'a_fun' would cause a segfault.
4
!
5
! Posted on the gfortran list by Marco Restelli http://gcc.gnu.org/ml/fortran/2009-01/
6
 
7
!
8
module mod_a
9
  implicit none
10
  public :: a_fun, t_1, t_2
11
  private
12
  type t_1
13
    real :: coeff
14
  end type t_1
15
  type t_2
16
    type(t_1), allocatable :: mons(:)
17
  end type t_2
18
contains
19
  function a_fun(r) result(p)
20
    integer, intent(in) :: r
21
    type(t_2) :: p(r+1)
22
    p = t_2 ([t_1 (99)])
23
  end function a_fun
24
end module mod_a
25
 
26
program test
27
  use mod_a, only: a_fun, t_1, t_2
28
  implicit none
29
  type(t_2) x(1)
30
  x = a_fun(0)
31
  if (any (x(1)%mons%coeff .ne. 99)) call abort
32
end program test
33
! { dg-final { cleanup-modules "mod_a" } }

powered by: WebSVN 2.1.0

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