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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #3)
> (In reply to Andrew Benson from comment #2)
> > (In reply to Dominique d'Humieres from comment #1)
> > > Confirmed. For me it segfaults from GCC7 up to GCC11.
> > 
> > Interesting. This started occurring for me when I updated from GCC10.1 to
> > 11. But, the code I posted is a reduced test case that I created - so maybe
> > the original (non-reduced-test-case) code wasn't triggering this previously
> > for some reason.
> 
> In Gcc 10.1, we did not call the finalizer for all required instances
> (PR 94109).  This has been fixed for gcc11 and the upcoming 10.2 release.
> 
> It is likely that calling a (required?) finalizer again has led to
> the segfault reappearing.
> 
> (Our finalizer handling is a mess, this and PDTs are really the
> only two really buggy fields for F2003 conformance).

The segfault is caused by the following:
                {
                  struct array01_vs parm.6;

                  parm.6.span = 64;
                  parm.6.dtype = {.elem_len=64, .rank=1, .type=5};
                  parm.6.dim[0].lbound = 1;
                  parm.6.dim[0].ubound = 2;
                  parm.6.dim[0].stride = 1;
                  parm.6.data = (void *) &ptr1->n[0];
                  parm.6.offset = -1;
                  __final_a_Vs (&parm.6);
                }

whereas the template for __final_a_Vs is:

integer(kind=4) __final_a_Vs (struct array15_vs & restrict array,
integer(kind=8) byte_stride, logical(kind=1) fini_coarray)

at a minimum, 'byte_stride' is required in the call

I have a mostly complete patch, for finalizers in general, which includes this
and so fixes the segfault.

I hope to submit the current version of the patch today because we have started
stage 4.

Paul

Reply via email to