public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/31059] bounds-check does not detect nonconforming assignment arrays
Date: Wed, 30 Aug 2023 20:53:42 +0000	[thread overview]
Message-ID: <bug-31059-4-rix9Kpc8Z4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-31059-4@http.gcc.gnu.org/bugzilla/>

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #9 from anlauf at gcc dot gnu.org ---
Created attachment 55821
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55821&action=edit
Partial patch (proof of concept)

The attached patch adds bounds-checking for the case that the r.h.s. has
only an array constructor.

Note the the original testcase is bogus, as it does not prevent (re)allocation
on assignment, which became default in F2003.

Adjusted testcase:

program p
  integer              :: jvec(3) = [1,2,3]
  integer, allocatable :: ivec(:)
  allocate (ivec(2))
  ivec(:) = [4,5,6] ! shall be detected
  ivec(:) = jvec    ! already detected
end

  parent reply	other threads:[~2023-08-30 20:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-31059-4@http.gcc.gnu.org/bugzilla/>
2010-12-29 15:23 ` [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays dfranke at gcc dot gnu.org
2010-12-29 15:24 ` dfranke at gcc dot gnu.org
2023-08-30 20:53 ` anlauf at gcc dot gnu.org [this message]
2023-08-31 20:15 ` [Bug fortran/31059] bounds-check does not detect nonconforming assignment arrays anlauf at gcc dot gnu.org
2023-08-31 20:44 ` anlauf at gcc dot gnu.org
2023-09-01 20:42 ` cvs-commit 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-31059-4-rix9Kpc8Z4@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).