From patchwork Fri Mar 16 19:22:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Kargl X-Patchwork-Id: 887107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-474878-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Tlzlk6N5"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 402wMw1chSz9sDr for ; Sat, 17 Mar 2018 06:22:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=Lj01KW9Z7F9hqKTCPd2FE28nxD/2LTANcpEN/TG6lql nOPKvDi8yhZuXnAwCc4OpwSmL9NzVj+ZsYfHyu600GCDc0TYm1BY8t8tFjsqFldo 4/clSAvmb2F4BiSZGNxKC2FCcUJI87nPzeRzit1tivb/RVXV4HD58QLdBbYuvYY4 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=JJ+hMVCTTtuq8pPBtDZWmUkSKeU=; b=Tlzlk6N5MvQeOx5UT XB9EMHBvaW+xTK4gquowPlXBY8oUqpqFSG0d0s9abG4j8heN0C0lndrOq2pFaWo9 HPjVqkwAR6EpJ1EE13GOh/INo5psXDvLnNr1tFVQiBWMpee+z1AqtUwAYn9lRwX7 0XIMD+iw5bqIA16/mgB8G3NA7Q= Received: (qmail 2776 invoked by alias); 16 Mar 2018 19:22:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 2756 invoked by uid 89); 16 Mar 2018 19:22:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=sum X-Spam-User: qpsmtpd, 2 recipients 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; Fri, 16 Mar 2018 19:22:41 +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 w2GJMegw074337 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 16 Mar 2018 12:22:40 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w2GJMedi074336; Fri, 16 Mar 2018 12:22:40 -0700 (PDT) (envelope-from sgk) Date: Fri, 16 Mar 2018 12:22:40 -0700 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [Committed] PR fortran/69395 -- Correct error condition Message-ID: <20180316192239.GA74316@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) The following patch fixes essentially and off-by-one in the error condition. Committed as obvious. 2018-03-16 Steven G. Kargl PR fortran/69395 * decl.c (merge_array_spec): Correct the error condition. 2018-03-16 Steven G. Kargl PR fortran/69395 * gfortran.dg/pr69395.f90: Add test for max dimensions Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 258581) +++ gcc/fortran/decl.c (working copy) @@ -871,7 +871,7 @@ merge_array_spec (gfc_array_spec *from, gfc_array_spec } } - if (to->rank + to->corank >= GFC_MAX_DIMENSIONS) + if (to->rank + to->corank > GFC_MAX_DIMENSIONS) { gfc_error ("Sum of array rank %d and corank %d at %C exceeds maximum " "allowed dimensions of %d", Index: gcc/testsuite/gfortran.dg/pr69395.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr69395.f90 (revision 258580) +++ gcc/testsuite/gfortran.dg/pr69395.f90 (working copy) @@ -1,5 +1,6 @@ ! { dg-do compile } ! { dg-options "-fcoarray=single" } program p +real, dimension(1,2,1,2,1,2,1,2), codimension[1,2,1,2,1,2,*] :: y real, dimension(1,2,1,2,1,2,1,2), codimension[1,2,1,2,1,2,1,*] :: z ! { dg-error "allowed dimensions" } end