Re: [patch, fortran] Fix PR 115260, data corruption on inline packing / unpacking

Paul Richard Thomas <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <CAGkQGiJfMpsCpuU1px957XnNEftyVbnmpJ-9kzZX85k_fHOHAg@mail.gmail.com>
Hello Thomas,

As usual, elegance and simplicity certainly go together in your patch! LGTM.

OK for mainline and backporting all the way to 13-branch. I don't
think that you need wait very long for backporting.

Best regards and thanks for the patch

Paul



On Tue, 19 May 2026 at 11:58, Thomas Koenig <[email protected]> wrote:
>
> Hello world,
>
> the patch below fixes a far-reaching wrong-code regression. Regression
> tested.  OK for trunk and backport as far as possible?
>
> (I particularly want to get this into gcc 13 while there still is time)
>
> Best regards
>
>         Thomas
>
> PR fortran/115260 - fix data corruption on inline packing/unpacking
>
> This patch fixes a data corruption occuring when a non-contiguous slice
> of an
> allocatable array component was passed to a procedure expecting a g77-style
> argument.  The problem was the inline packing (PR fortran/88821) which went
> astray gfc_trans_scalar_assign was told to deallocate the argument upon
> return.
>
> The solution was to not pass that argument if passing a g77-style array,
> in effect a one-liner.
>
> This is a regression which goes back to all supported releases.
>
> gcc/fortran/ChangeLog:
>
>         PR fortran/115260
>         * trans-expr.cc (gfc_conv_subref_array_arg): Pass false to
>         dealloc argument of gfc_trans_scalar_assign if we are
>         converting a g77-style argument.
>
> gcc/testsuite/ChangeLog:
>
>         PR fortran/115260
>         * gfortran.dg/pr115260.f90: New test.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.