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

--- Comment #17 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Paul Thomas from comment #16)
> (In reply to Jerry DeLisle from comment #15)
> > (In reply to Paul Thomas from comment #14)
> > > PS If I remove the STAT= from the allocate, the code runs just fine in DEV
> > > mode.
> > > 
> > > Paul
> > 
> > I have not looke at this one. Have you tried with valgrind or sanitize tools
> > to see if there are any further hints?
> 
> You will see from the above that the reporter himself has done this already.
> Just for the record, the backtrace from the error is:
> 
> Program aborted. Backtrace:
> #0  0x4595c4 in __stsubs_MOD_clone_object
>       at
> /home/pault/prs/pr80850/GFC-master-790d92e9ccc22c559db4118f2b8a51170c135b19/
> stsubs.F90:305
> #1  0x470f0e in __gfc_base_MOD_contelemconstruct
>       at
> /home/pault/prs/pr80850/GFC-master-790d92e9ccc22c559db4118f2b8a51170c135b19/
> gfc_base.F90:354
> #2  0x438586 in __gfc_vector_MOD_vectorelemconstruct
>       at
> /home/pault/prs/pr80850/GFC-master-790d92e9ccc22c559db4118f2b8a51170c135b19/
> gfc_vector.F90:211
> #3  0x4266cd in __gfc_vector_MOD_vectoriterappend
>       at
> /home/pault/prs/pr80850/GFC-master-790d92e9ccc22c559db4118f2b8a51170c135b19/
> gfc_vector.F90:807
> #4  0x44a83e in __gfc_graph_MOD_graphiterappendvertex
>       at
> /home/pault/prs/pr80850/GFC-master-790d92e9ccc22c559db4118f2b8a51170c135b19/
> gfc_graph.F90:1113
> #5  0x45022e in __gfc_graph_test_MOD_test_gfc_graph
>       at
> /home/pault/prs/pr80850/GFC-master-790d92e9ccc22c559db4118f2b8a51170c135b19/
> gfc_graph.F90:1402
> #6  0x403ac1 in MAIN__
>       at
> /home/pault/prs/pr80850/GFC-master-790d92e9ccc22c559db4118f2b8a51170c135b19/
> main.F90:94
> #7  0x403ed5 in main
> 
> gfc_vector.F90:807 contains a call that looks horribly like the problem line
> in PR81758
> call
> this%container%vec_tile(q(4))%tile_batch(q(3))%batch_seg(q(2))%seg_elem(q(1))
> %&
>                  &vector_elem_ctor(elem_val,ierr,assoc_only=assoc)
> 
> However, it is definitely the allocate that is the problem as evidenced by
> it disappearing if STAT is not used.
> 
> Unfortunately, as Dmitry reports above, the fault also goes away in gdb :-(
> 
> Cheers
> 
> Paul

I instrumented trans.c:(gfc_allocate_using_malloc) by setting the STAT variable
to the requested size, when an allocation error is detected. When the code
fails, this is a typical outcome:

 >>>>> errc =   1713129088
 #ERROR(stsubs:clone_object): sourced allocate() failed: Attempt to allocate an
allocated object                                                                

Somewhere, use is being made of an uninitialized variable upstream from
stsubs.F90(clone_object).

Paul

Reply via email to