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/108527] [13 Regression] ICE in compare_bound_int(): Bad expression
Date: Tue, 24 Jan 2023 19:02:24 +0000	[thread overview]
Message-ID: <bug-108527-4-IWS74UMZrV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108527-4@http.gcc.gnu.org/bugzilla/>

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

kargl at gcc dot gnu.org changed:

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

--- Comment #2 from kargl at gcc dot gnu.org ---
This fixes all testcases.  These two helper functions can indicate
a problem occurs, so instead of asserting on (a->ts.type != BT_INTEGER)
return the CMP_UNKNOWN condition.  This does give a few run-on 
errors.


diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 94213cd3cd4..c5e1b87f8fe 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -4575,12 +4575,11 @@ compare_bound_int (gfc_expr *a, int b)
 {
   int i;

-  if (a == NULL || a->expr_type != EXPR_CONSTANT)
+  if (a == NULL
+      || a->expr_type != EXPR_CONSTANT
+      || a->ts.type != BT_INTEGER)
     return CMP_UNKNOWN;

-  if (a->ts.type != BT_INTEGER)
-    gfc_internal_error ("compare_bound_int(): Bad expression");
-
   i = mpz_cmp_si (a->value.integer, b);

   if (i < 0)
@@ -4598,12 +4597,11 @@ compare_bound_mpz_t (gfc_expr *a, mpz_t b)
 {
   int i;

-  if (a == NULL || a->expr_type != EXPR_CONSTANT)
+  if (a == NULL
+      || a->expr_type != EXPR_CONSTANT
+      || a->ts.type != BT_INTEGER)
     return CMP_UNKNOWN;

-  if (a->ts.type != BT_INTEGER)
-    gfc_internal_error ("compare_bound_int(): Bad expression");
-
   i = mpz_cmp (a->value.integer, b);

   if (i < 0)

  parent reply	other threads:[~2023-01-24 19:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 17:51 [Bug fortran/108527] New: " gscfq@t-online.de
2023-01-24 18:42 ` [Bug fortran/108527] " anlauf at gcc dot gnu.org
2023-01-24 19:02 ` kargl at gcc dot gnu.org [this message]
2023-01-24 19:32 ` anlauf at gcc dot gnu.org
2023-01-24 20:51 ` anlauf at gcc dot gnu.org
2023-01-24 20:52 ` sgk at troutmask dot apl.washington.edu
2023-01-24 21:49 ` anlauf at gcc dot gnu.org
2023-01-25  7:36 ` rguenth at gcc dot gnu.org
2023-01-25  9:48 ` marxin at gcc dot gnu.org
2023-01-25 19:29 ` anlauf at gcc dot gnu.org
2023-01-28 21:00 ` cvs-commit at gcc dot gnu.org
2023-02-05 19:28 ` cvs-commit at gcc dot gnu.org
2023-02-10 19:29 ` cvs-commit at gcc dot gnu.org
2023-02-11 18:16 ` cvs-commit at gcc dot gnu.org
2023-02-11 18:18 ` 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-108527-4-IWS74UMZrV@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).