From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71525 invoked by alias); 9 Dec 2018 06:31:42 -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 71210 invoked by uid 89); 9 Dec 2018 06:31:09 -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=Hx-languages-length:1563, COMMON, definable 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 06:31:07 +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 wB96V5uH050656 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 8 Dec 2018 22:31:05 -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 wB96V5st050655; Sat, 8 Dec 2018 22:31:05 -0800 (PST) (envelope-from sgk) Date: Sun, 09 Dec 2018 06:31:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [Committed] PR fortran/88048 -- named constant can't be data object Message-ID: <20181209063105.GA50631@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LQksG6bCIzRHxTLp" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2018-12/txt/msg00529.txt.bz2 --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 370 A named constant cannot be a data object. The committed patch catches an instance that should be caught. 2018-12-08 Steven G. Kargl PR fortran/88048 * resolve.c (check_data_variable): Named constant cannot be a data object. 2018-12-08 Steven G. Kargl PR fortran/88048 * gfortran.dg/pr88048.f90: New test. -- Steve --LQksG6bCIzRHxTLp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="z_pr88048.diff" Content-length: 1214 Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 266912) +++ gcc/fortran/resolve.c (working copy) @@ -15493,7 +15493,10 @@ check_data_variable (gfc_data_variable *var, locus *wh e = e->value.function.actual->expr; if (e->expr_type != EXPR_VARIABLE) - gfc_internal_error ("check_data_variable(): Bad expression"); + { + gfc_error ("Expecting definable entity near %L", where); + return false; + } sym = e->symtree->n.sym; @@ -15501,6 +15504,7 @@ check_data_variable (gfc_data_variable *var, locus *wh { gfc_error ("BLOCK DATA element %qs at %L must be in COMMON", sym->name, &sym->declared_at); + return false; } if (e->ref == NULL && sym->as) Index: gcc/testsuite/gfortran.dg/pr88048.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr88048.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr88048.f90 (working copy) @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR fortran/88048 +program p + integer, parameter :: a(2) = 1 + data a(2) /a(1)/ ! { dg-error "definable entity" } + print *, a +end --LQksG6bCIzRHxTLp--