URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [alloc_comp_assign_10.f90] - Rev 694
Compare with Previous | Blame | View Log
! { dg-do run }!! Test the fix for PR39879, in which gfc gagged on the double! defined assignment where the rhs had a default initialiser.!! Contributed by David Sagan <david.sagan@gmail.com>!module test_structinterface assignment (=)module procedure tao_lat_equal_tao_latend interfacetype bunch_params_structinteger n_live_particleend typetype tao_lattice_structtype (bunch_params_struct), allocatable :: bunch_params(:)type (bunch_params_struct), allocatable :: bunch_params2(:)end typetype tao_universe_structtype (tao_lattice_struct), pointer :: model, designcharacter(200), pointer :: descrip => NULL()end typetype tao_super_universe_structtype (tao_universe_struct), allocatable :: u(:)end typetype (tao_super_universe_struct), save, target :: scontainssubroutine tao_lat_equal_tao_lat (lat1, lat2)implicit nonetype (tao_lattice_struct), intent(inout) :: lat1type (tao_lattice_struct), intent(in) :: lat2if (allocated(lat2%bunch_params)) thenlat1%bunch_params = lat2%bunch_paramsend ifif (allocated(lat2%bunch_params2)) thenlat1%bunch_params2 = lat2%bunch_params2end ifend subroutineend moduleprogram tao_programuse test_structimplicit nonetype (tao_universe_struct), pointer :: uinteger n, iallocate (s%u(1))u => s%u(1)allocate (u%design, u%model)n = 112allocate (u%model%bunch_params(0:n), u%design%bunch_params(0:n))u%design%bunch_params%n_live_particle = [(i, i = 0, n)]u%model = u%designu%model = u%design ! The double assignment was the cause of the ICEif (.not. allocated (u%model%bunch_params)) call abortif (any (u%model%bunch_params%n_live_particle .ne. [(i, i = 0, n)])) call abortDeallocate (u%model%bunch_params, u%design%bunch_params)deallocate (u%design, u%model)deallocate (s%u)end program! { dg-final { cleanup-modules "test_struct" } }
