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/107508] Invalid bounds due to bogus reallocation on assignment with KIND=4 characters
Date: Mon, 07 Nov 2022 10:33:19 +0000	[thread overview]
Message-ID: <bug-107508-4-WrW3wgcAPf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107508-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:071d00e0faabbd45449d2e83f207fca0f8e8ef68

commit r13-3751-g071d00e0faabbd45449d2e83f207fca0f8e8ef68
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Nov 7 11:32:33 2022 +0100

    Fortran: Fix reallocation on assignment for kind=4 strings [PR107508]

    The check whether reallocation on assignment was required did not handle
    kind=4 characters correctly such that there was always a reallocation,
    implying issues with pointer addresses and lower bounds.  Additionally,
    with all deferred strings, the old memory was not freed on reallocation.
    And, finally, inside the block which was only executed if string lengths
    or bounds or dynamic types changed, was a subcheck of the same, which
    was effectively a no op but still confusing and at least added with -O0
    extra instructions to the binary.

            PR fortran/107508

    gcc/fortran/ChangeLog:

            * trans-array.cc (gfc_alloc_allocatable_for_assignment): Fix
            string-length check, plug memory leak, and avoid generation of
            effectively no-op code.
            * trans-expr.cc (alloc_scalar_allocatable_for_assignment): Extend
            comment; minor cleanup.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/widechar_11.f90: New test.

  reply	other threads:[~2022-11-07 10:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 13:13 [Bug fortran/107508] New: " burnus at gcc dot gnu.org
2022-11-07 10:33 ` cvs-commit at gcc dot gnu.org [this message]
2023-01-12 21:23 ` [Bug fortran/107508] " 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-107508-4-WrW3wgcAPf@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).