[Fortran, Patch, pr65795, v1] Segfault (invalid write) for ALLOCATE statement involving COARRAYS
Jerry DeLisle
jvdelisle@charter.net
Sun Apr 3 19:22:00 GMT 2016
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
More information about the Fortran
mailing list