Re: [Patch, fortran] PR114021 -ICE with allocation of scalar pointer entity where SOURCE=f() with f() returning a pointer

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

Thank you for the review. Hold off raising a PR, I'll have a stab at
fixing the new testcase.

Tschuess

Paul

On Thu, 26 Mar 2026 at 19:57, Harald Anlauf <[email protected]> wrote:
>
> Hi Paul,
>
> the patch fixes the ICE as advertised, so it is OK.
> Thanks for the patch!
>
> There is a small variation of the testcase where the assignment
> leads to too many evaluations of the r.h.s., see attached testcase.
> In this case 3 instead of one; other brands get this right.
>
> Shall I open a separate PR for this problem?
>
> Best,
> Harald
>
> On 3/26/26 15:16, Paul Richard Thomas wrote:
> > Hello All,
> >
> > Thanks to Harald for pointing out this low hanging fruit to me.
> >
> > The original ICE has changed to one that is easily identified and
> > fixed: dereferencing a NULL pointer in trans_allocate. This is fixed
> > in the third chunk. In this case, a symtree is now provided by  a
> > modified version of gfc_get_unique symtree, which is the content of
> > the first chunk. Also, deallocation of non-variable, pointer source
> > allocatable components has been suppressed in the second chunk.
> >
> > The resulting behaviour of the testcase has been tested against that
> > of other brands, since it wasn't evident to me from reading the F2018
> > standard that the deep copy of the allocatable component is correct.
> >
> > Regtested on FC43/x86_64 - OK for mainline?
> >
> > Paul
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.