From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E519D3858D33; Tue, 24 Jan 2023 19:02:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E519D3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674586944; bh=2STOkwS+rjfmZN7dXThFXzDR3dpjPdl0fVwpkZHNwQc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pi27jwpC5WK3HK4xfe4cdhJn/W5M2KvsMjFKZbh+Y6t4eAuvwHJmMnCQaiS2dqijZ CCfY4pUHg7mGeV2gVJGqafCYd/ljdeNO5UsBSRELtRHWbOcgHI7fC8P5x560HCa6Ez G+SMq0Cq7+WVVEc6qpjmjaDXelPu1qAB7ul7gX8U= From: "kargl at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108527 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 !=3D BT_INTEGER) return the CMP_UNKNOWN condition. This does give a few run-on=20 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 =3D=3D NULL || a->expr_type !=3D EXPR_CONSTANT) + if (a =3D=3D NULL + || a->expr_type !=3D EXPR_CONSTANT + || a->ts.type !=3D BT_INTEGER) return CMP_UNKNOWN; - if (a->ts.type !=3D BT_INTEGER) - gfc_internal_error ("compare_bound_int(): Bad expression"); - i =3D 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 =3D=3D NULL || a->expr_type !=3D EXPR_CONSTANT) + if (a =3D=3D NULL + || a->expr_type !=3D EXPR_CONSTANT + || a->ts.type !=3D BT_INTEGER) return CMP_UNKNOWN; - if (a->ts.type !=3D BT_INTEGER) - gfc_internal_error ("compare_bound_int(): Bad expression"); - i =3D mpz_cmp (a->value.integer, b); if (i < 0)=