[Bug fortran/87359] [9 regression] pointer being freed was not allocated

juergen.reuter at desy dot de gcc-bugzilla@gcc.gnu.org
Sat Sep 22 21:49:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87359

--- Comment #32 from Jürgen Reuter <juergen.reuter at desy dot de> ---
Paul, I found a workaround: in lines 530-533 in the file
src/transforms/evt_nlo.f90 there is an assignment of an allocatable array of
different DT components which apparently doesn't work any more. Changing 
   530         select type (phs => process_instance%term(i_real)%k_term%phs)
   531         type is (phs_fks_t)
   532            event_deps%phs_identifiers = phs%phs_identifiers
   533         end select
into 
   530         select type (phs => process_instance%term(i_real)%k_term%phs)    
   531         type is (phs_fks_t)
   532            allocate (event_deps%phs_identifiers (size
(phs%phs_identifiers)))
   533            do i = 1, size (phs%phs_identifiers)
   534               event_deps%phs_identifiers(i) = phs%phs_identifiers(i)
   535            end do
   536            ! event_deps%phs_identifiers = phs%phs_identifiers
   537         end select
solves the issue of all four failing tests. 
phs_identifiers is an allocatable array of type phs_identifier_t as defined in
the type
nlo_event_deps_t (lines 62-72 of evt_nlo.f90).
integer, dimension(:), allocatable :: phs_identifiers
And the type phs_identifier_t is defined in src/phase_space/phs_fks.f90, lines
264-275:
   264    type :: phs_identifier_t
   265       integer, dimension(:), allocatable :: contributors
   266       integer :: emitter = -1
   267       logical :: evaluated = .false.
   268    contains
   269      generic :: init => init_from_emitter,
init_from_emitter_and_contributors
   270      procedure :: init_from_emitter => phs_identifier_init_from_emitter
   271      procedure :: init_from_emitter_and_contributors &
   272         => phs_identifier_init_from_emitter_and_contributors
   273      procedure :: check => phs_identifier_check
   274      procedure :: write => phs_identifier_write
   275    end type phs_identifier_t
So it has an allocatable integer array as DT component. Maybe gfortran hiccups
on the allocation-on-assigment of something that is an allocatable DT with
allocatable DT components?


More information about the Gcc-bugs mailing list