public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/104352] ICE in gfc_conv_intrinsic_anyall, at fortran/trans-intrinsic.cc:4481 (etc.)
Date: Wed, 25 May 2022 20:37:00 +0000	[thread overview]
Message-ID: <bug-104352-4-jceLcVe26t@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104352-4@http.gcc.gnu.org/bugzilla/>

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-05-25
           Priority|P3                          |P4
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from kargl at gcc dot gnu.org ---
It make absolutely no sense to emit a warning when gfortran
detects an out-of-bounds array index.  This patch fixes the
ICE and fixes the second error message to report that it is
the upper bound not the lower bound that errors out.

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 2ebf076f730..52a394db26a 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -4754,19 +4754,19 @@ check_dimension (int i, gfc_array_ref *ar,
gfc_array_spec *as)
          {
            if (compare_bound (AR_START, as->lower[i]) == CMP_LT)
              {
-               gfc_warning (0, "Lower array reference at %L is out of bounds "
+               gfc_error ("Lower array reference at %L is out of bounds "
                       "(%ld < %ld) in dimension %d", &ar->c_where[i],
                       mpz_get_si (AR_START->value.integer),
                       mpz_get_si (as->lower[i]->value.integer), i+1);
-               return true;
+               return false;
              }
            if (compare_bound (AR_START, as->upper[i]) == CMP_GT)
              {
-               gfc_warning (0, "Lower array reference at %L is out of bounds "
+               gfc_error ("Upper array reference at %L is out of bounds "
                       "(%ld > %ld) in dimension %d", &ar->c_where[i],
                       mpz_get_si (AR_START->value.integer),
                       mpz_get_si (as->upper[i]->value.integer), i+1);
-               return true;
+               return false;
              }
          }

  parent reply	other threads:[~2022-05-25 20:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02 18:48 [Bug fortran/104352] New: " gscfq@t-online.de
2022-02-02 18:50 ` [Bug fortran/104352] " gscfq@t-online.de
2022-05-25 20:37 ` kargl at gcc dot gnu.org [this message]
2022-10-21 20:18 ` anlauf at gcc dot gnu.org
2023-05-17 19:56 ` cvs-commit at gcc dot gnu.org
2023-05-17 20:00 ` anlauf at gcc dot gnu.org
2024-04-02 17:07 ` 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-104352-4-jceLcVe26t@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).