From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14282 invoked by alias); 17 Feb 2020 13:17:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 14265 invoked by uid 89); 17 Feb 2020 13:17:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_COUK,KAM_NUMSUBJECT,KAM_SHORT,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: imap3.hz.codethink.co.uk Received: from imap3.hz.codethink.co.uk (HELO imap3.hz.codethink.co.uk) (176.9.8.87) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Feb 2020 13:17:50 +0000 Received: from [167.98.27.226] (helo=[10.35.5.172]) by imap3.hz.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1j3gHU-0001OA-8g; Mon, 17 Feb 2020 13:17:48 +0000 To: gcc-patches , fortran From: Mark Eggleston Subject: [Regression, patch][Fortran] ICE in gfc_typenode_for_spec PR93603 Message-ID: <9a0ae9c5-9f81-45ac-e43c-0a80c4d4f04b@codethink.co.uk> Date: Mon, 17 Feb 2020 13:17:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------939AA2B185B68AD820068935" X-SW-Source: 2020-02/txt/msg00951.txt.bz2 This is a multi-part message in MIME format. --------------939AA2B185B68AD820068935 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-length: 615 Please find attached fix for PR fortran/93603. gcc/fortran/ChangeLog     Steven G. Kargl      PR fortran/93603     * match.c (gfc_match_associate) : If target expression     has the type BT_BOZ output an error and goto     assocListError. gcc/testsuite/ChangeLog     Mark Eggleston      PR fortran/93603     * gfortran.dg/pr93603.f90 : New test. Tested using make with check-fortran on master at: https://gcc.gnu.org/g:f82617f229b336d856c18313339b14657e05c129 OK to commit? -- https://www.codethink.co.uk/privacy.html --------------939AA2B185B68AD820068935 Content-Type: text/x-patch; charset=UTF-8; name="0001-Fortran-ICE-in-gfc_typenode_for_spec-PR93603.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fortran-ICE-in-gfc_typenode_for_spec-PR93603.patch" Content-length: 1967 >From 42e66ff8910e995e6b8fb9bb597a09ec7be07def Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Fri, 7 Feb 2020 11:39:37 +0000 Subject: [PATCH] [Fortran] ICE in gfc_typenode_for_spec PR93603 Associating a symbol with a BOZ constant caused an ICE. Output an error message as an association target cannot be a BOZ constant. Original patch provided by Steven G. Kargl . gcc/fortran/ChangeLog PR fortran/93603 * match.c (gfc_match_associate) : If target expression has the type BT_BOZ output an error and goto assocListError. gcc/testsuite/ChangeLog PR fortran/93603 * gfortran.dg/pr93603.f90 : New test. --- gcc/fortran/match.c | 8 ++++++++ gcc/testsuite/gfortran.dg/pr93603.f90 | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr93603.f90 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index a74cb8c5c19..9c2ec41c49c 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1957,6 +1957,14 @@ gfc_match_associate (void) goto assocListError; } + /* The target expression cannot be a BOZ literal constant. */ + if (newAssoc->target->ts.type == BT_BOZ) + { + gfc_error ("Association target at %L cannot be a BOZ literal " + "constant", &newAssoc->target->where); + goto assocListError; + } + /* The `variable' field is left blank for now; because the target is not yet resolved, we can't use gfc_has_vector_subscript to determine it for now. This is set during resolution. */ diff --git a/gcc/testsuite/gfortran.dg/pr93603.f90 b/gcc/testsuite/gfortran.dg/pr93603.f90 new file mode 100644 index 00000000000..fd452e52ca2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr93603.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } + +program p + associate (y => z'1') ! { dg-error "cannot be a BOZ literal constant" } + end associate ! { dg-error "Expecting END PROGRAM" } +end + -- 2.11.0 --------------939AA2B185B68AD820068935--