From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111114 invoked by alias); 9 Dec 2018 20:28:25 -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 111085 invoked by uid 89); 9 Dec 2018 20:28:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=goto, Hx-languages-length:1384, Burn, burn X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 09 Dec 2018 20:28:23 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id wB9KSLY6089838 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 9 Dec 2018 12:28:21 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id wB9KSL8d089837; Sun, 9 Dec 2018 12:28:21 -0800 (PST) (envelope-from sgk) Date: Sun, 09 Dec 2018 20:28:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [Committed] PR fortran/88206 -- Fix REAL issue with array constructor Message-ID: <20181209202821.GA89818@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2018-12/txt/msg00547.txt.bz2 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 365 The attach patch fixes an issue where REAL intrinsic can confuse typespec rsolution in an array constructor. 2018-12-09 Steven G. Kargl PR fortran/88206 * match.c (gfc_match_type_spec): REAL can be an intrinsic function. 2018-12-09 Steven G. Kargl PR fortran/88206 * gfortran.dg/pr88206.f90: New test. -- Steve --M9NhX3UHpAaciwkO Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pr88206.diff" Content-length: 1011 Index: gcc/fortran/match.c =================================================================== --- gcc/fortran/match.c (revision 266929) +++ gcc/fortran/match.c (working copy) @@ -2225,6 +2225,9 @@ found: return MATCH_NO; } + if (e->expr_type != EXPR_CONSTANT) + goto ohno; + gfc_next_char (); /* Burn the ')'. */ ts->kind = (int) mpz_get_si (e->value.integer); if (gfc_validate_kind (ts->type, ts->kind , true) == -1) @@ -2238,6 +2241,8 @@ found: return MATCH_YES; } } + +ohno: /* If a type is not matched, simply return MATCH_NO. */ gfc_current_locus = old_locus; Index: gcc/testsuite/gfortran.dg/pr88206.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr88206.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr88206.f90 (working copy) @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/88206 +program p + integer, parameter :: z(4) = [1,2,3,4] + integer :: k = 2 + print *, [real(z(k))] +end + --M9NhX3UHpAaciwkO--