This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Fortran, Patch, pr65795, v1] Segfault (invalid write) for ALLOCATE statement involving COARRAYS
- From: Jerry DeLisle <jvdelisle at charter dot net>
- To: Andre Vehreschild <vehre at gmx dot de>, GCC-Patches-ML <gcc-patches at gcc dot gnu dot org>, GCC-Fortran-ML <fortran at gcc dot gnu dot org>
- Date: Sun, 3 Apr 2016 12:22:00 -0700
- Subject: Re: [Fortran, Patch, pr65795, v1] Segfault (invalid write) for ALLOCATE statement involving COARRAYS
- Authentication-results: sourceware.org; auth=none
- References: <20160403153547 dot 5b7ff61a at vepi2>
On 04/03/2016 06:35 AM, Andre Vehreschild wrote:
> Hi all,
>
> attached patch fixes a segfault when allocating a coarray of a type
> that has allocatable components. Before the patch the compiler tried
> to ref the component to nullify from the coarray's base address and not
> from its .data component. The proposed patch fixes this by preventing
> the nullify of the components in the array_allocate() for coarrays,
> because the components are nullified again afterwards by copying a
> fully nullified copy of the type to the coarray's data component.
>
> There albeit is an alternative to this patch:
>
> trans-array.c: 5556+
>
> - tmp = gfc_nullify_alloc_comp (expr->ts.u.derived, se->expr,
> + tmp = gfc_nullify_alloc_comp (expr->ts.u.derived, coarray ?
> + pointer : se->expr,
> ref->u.ar.as->rank);
>
> The above adds a second nullify to the generated code before the one
> done the object copy mentioned above.
>
> Because I am unsure which patch is best, I propose both. I do favor of
> course the one without the duplicate nullify as attached.
>
> Bootstrapped and regtested ok on x86_64-linux-gnu/F23. Ok for trunk?
>
> The patch also applies (with a small delta) to gcc-5 w/o any
> regressions. Ok for gcc-5-branch?
>
> Regards,
> Andre
>
OK for trunk and gcc-5. Go with your preferred.
Jerry