public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/110415] (Re)allocation on assignment to allocatable polymorphic variable from allocatable polymorphic function result
Date: Tue, 28 Nov 2023 15:28:00 +0000	[thread overview]
Message-ID: <bug-110415-4-V3v26ZhGzS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110415-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Jenner <andrewjenner@gcc.gnu.org>:

https://gcc.gnu.org/g:b247e917ff13328298c1eecf8563b12edd7ade04

commit r14-5931-gb247e917ff13328298c1eecf8563b12edd7ade04
Author: Andrew Jenner <andrew@codesourcery.com>
Date:   Tue Nov 28 15:27:05 2023 +0000

    Fortran: fix reallocation on assignment of polymorphic variables [PR110415]

    This patch fixes two bugs related to polymorphic class assignment in the
    Fortran front-end. One (described in PR110415) is an issue with the malloc
    and realloc calls using the size from the old vptr rather than the new one.
    The other is caused by the return value from the realloc call being
ignored.
    Testcases are added for these issues.

    2023-11-28  Andrew Jenner  <andrew@codesourcery.com>

    gcc/fortran/
            PR fortran/110415
            * trans-expr.cc (trans_class_vptr_len_assignment): Add
            from_vptrp parameter. Populate it. Don't check for DECL_P
            when deciding whether to create temporary.
            (trans_class_pointer_fcn, gfc_trans_pointer_assignment): Add
            NULL argument to trans_class_vptr_len_assignment calls.
            (trans_class_assignment): Get rhs_vptr from
            trans_class_vptr_len_assignment and use it for determining size
            for allocation/reallocation. Use return value from realloc.

    gcc/testsuite/
            PR fortran/110415
            * gfortran.dg/pr110415.f90: New test.
            * gfortran.dg/asan/pr110415-2.f90: New test.
            * gfortran.dg/asan/pr110415-3.f90: New test.

    Co-Authored-By: Tobias Burnus  <tobias@codesourcery.com>

  parent reply	other threads:[~2023-11-28 15:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 15:47 [Bug fortran/110415] New: " everythingfunctional at protonmail dot com
2023-06-26 17:21 ` [Bug fortran/110415] " kargl at gcc dot gnu.org
2023-10-30 20:05 ` matthew.thompson at nasa dot gov
2023-11-20 14:07 ` burnus at gcc dot gnu.org
2023-11-28 15:28 ` cvs-commit at gcc dot gnu.org [this message]
2023-11-28 15:39 ` andrewjenner at gcc dot gnu.org
2024-05-21 19:16 ` anlauf at gcc dot gnu.org
2024-05-22 18:49 ` cvs-commit at gcc dot gnu.org
2024-05-22 18:52 ` anlauf at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110415-4-V3v26ZhGzS@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).