From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2071) id 9A2B83858D28; Wed, 25 Jan 2023 19:47:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A2B83858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674676034; bh=TTnpHBjdYLhG1wQKlVvDQlnDLNReLUnslp8Q5T86Fz4=; h=From:To:Subject:Date:From; b=GaMtcUwNAeuCDOrW8wL2CKYrb/7dyyHPOTDAPLuGbn8a53Fv7f9uIdxbVdxBGZMnj Jx522neYG5MnEE2njmmalU8acdvVJnGT+0gAJF3R5Ygkk/TFwQ+EaJ9dK9usNNF251 iyt6msYnc4EI0wMHZWzaLkzBdCsZacFz0rQ9LOeo= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Harald Anlauf To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5374] Fortran: ICE in gfc_compare_array_spec [PR108528] X-Act-Checkin: gcc X-Git-Author: Steve Kargl X-Git-Refname: refs/heads/master X-Git-Oldrev: 80cf2c5e8f496bed9c6facf55f9ae31d0d90fd28 X-Git-Newrev: 9fb9da3d38513d320bfea72050f7a59688595e0b Message-Id: <20230125194714.9A2B83858D28@sourceware.org> Date: Wed, 25 Jan 2023 19:47:14 +0000 (GMT) List-Id: https://gcc.gnu.org/g:9fb9da3d38513d320bfea72050f7a59688595e0b commit r13-5374-g9fb9da3d38513d320bfea72050f7a59688595e0b Author: Steve Kargl Date: Wed Jan 25 20:38:43 2023 +0100 Fortran: ICE in gfc_compare_array_spec [PR108528] gcc/fortran/ChangeLog: PR fortran/108528 * array.cc (compare_bounds): Return false instead of generating an internal error on an invalid argument type. gcc/testsuite/ChangeLog: PR fortran/108528 * gfortran.dg/pr108528.f90: New test. Diff: --- gcc/fortran/array.cc | 4 ++-- gcc/testsuite/gfortran.dg/pr108528.f90 | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc index e8a2c32a627..be5eb8b6a0f 100644 --- a/gcc/fortran/array.cc +++ b/gcc/fortran/array.cc @@ -967,7 +967,7 @@ gfc_copy_array_spec (gfc_array_spec *src) /* Returns nonzero if the two expressions are equal. - We should not need to support more than constant values, as that’s what is + We should not need to support more than constant values, as that's what is allowed in derived type component array spec. However, we may create types with non-constant array spec for dummy variable class container types, for which the _data component holds the array spec of the variable declaration. @@ -979,7 +979,7 @@ compare_bounds (gfc_expr *bound1, gfc_expr *bound2) if (bound1 == NULL || bound2 == NULL || bound1->ts.type != BT_INTEGER || bound2->ts.type != BT_INTEGER) - gfc_internal_error ("gfc_compare_array_spec(): Array spec clobbered"); + return false; /* What qualifies as identical bounds? We could probably just check that the expressions are exact clones. We avoid rewriting a specific comparison diff --git a/gcc/testsuite/gfortran.dg/pr108528.f90 b/gcc/testsuite/gfortran.dg/pr108528.f90 new file mode 100644 index 00000000000..7a353cb7eab --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr108528.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/108528 - +! Contributed by G.Steinmetz + +function f() ! { dg-error "mismatched array specifications" } + integer :: f((2.)) ! { dg-error "must be of INTEGER type" } + integer :: g((2)) +entry g() +end