URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [alloc_comp_assign_12.f03] - Rev 694
Compare with Previous | Blame | View Log
! { dg-do run }! PR48351 - automatic (re)allocation of allocatable components of class objects!! Contributed by Nasser M. Abbasi on comp.lang.fortran!module fooimplicit nonetype :: foo_tprivatereal, allocatable :: u(:)containsprocedure :: makeprocedure :: dispend type foo_tcontainssubroutine make(this,u)implicit noneclass(foo_t) :: thisreal, intent(in) :: u(:)this%u = u(int (u)) ! The failure to allocate occurred here.if (.not.allocated (this%u)) call abortend subroutine makefunction disp(this)implicit noneclass(foo_t) :: thisreal, allocatable :: disp (:)if (allocated (this%u)) disp = this%uend functionend module fooprogram main2use fooimplicit nonetype(foo_t) :: oreal, allocatable :: u(:)u=real ([3,2,1,4])call o%make(u)if (any (int (o%disp()) .ne. [1,2,3,4])) call abortu=real ([2,1])call o%make(u)if (any (int (o%disp()) .ne. [1,2])) call abortend program main2! { dg-final { cleanup-modules "foo" } }
