From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74637 invoked by alias); 29 Oct 2015 18:35:16 -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 74615 invoked by uid 89); 29 Oct 2015 18:35:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 29 Oct 2015 18:35:15 +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 t9TIZCwA067135 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 29 Oct 2015 11:35:13 -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 t9TIZCiD067134; Thu, 29 Oct 2015 11:35:12 -0700 (PDT) (envelope-from sgk) Date: Thu, 29 Oct 2015 18:36:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR fortran/36192 -- yet another fix for an ICE Message-ID: <20151029183512.GA67095@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99" Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2015-10/txt/msg03261.txt.bz2 --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 712 The patch for PR fortran/36192 that I committed here: https://gcc.gnu.org/ml/gcc-bugs/2015-10/msg02160.html cured an ICE for a testcase that was reduced from the originally submitted mutilated Fortran code. The original code could in fact invoke another ICE. This patch cures that ICE. The patch simply checks that the array indices have INTEGER type before calling GMP routines. Tested om x86_64-*-freebsd. OK to commit? 2015-10-29 Steven G. Kargl PR fortran/36192 * interface.c (get_expr_storage_size): Check for INTEGER type before calling gmp routines. 2015-10-29 Steven G. Kargl PR fortran/36192 * gfortran.dg/pr36192_1.f90: New test. -- Steve --5vNYLRcllDrimb99 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pr36192_1.diff" Content-length: 1357 Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 229542) +++ gcc/fortran/interface.c (working copy) @@ -2455,7 +2455,9 @@ get_expr_storage_size (gfc_expr *e) { if (ref->u.ar.as->lower[i] && ref->u.ar.as->upper[i] && ref->u.ar.as->lower[i]->expr_type == EXPR_CONSTANT - && ref->u.ar.as->upper[i]->expr_type == EXPR_CONSTANT) + && ref->u.ar.as->lower[i]->ts.type == BT_INTEGER + && ref->u.ar.as->upper[i]->expr_type == EXPR_CONSTANT + && ref->u.ar.as->upper[i]->ts.type == BT_INTEGER) elements *= mpz_get_si (ref->u.ar.as->upper[i]->value.integer) - mpz_get_si (ref->u.ar.as->lower[i]->value.integer) + 1L; Index: gcc/testsuite/gfortran.dg/pr36192_1.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr36192_1.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/pr36192_1.f90 (working copy) @@ -0,0 +1,12 @@ +! { dg-do compile } +! PR fortran/36192 +program three_body + real, parameter :: n = 2, d = 2 + real, dimension(n,d) :: x_hq ! { dg-error "of INTEGER type|of INTEGER type" } + call step(x_hq) + contains + subroutine step(x) + real, dimension(:,:), intent(in) :: x + end subroutine step +end program three_body +! { dg-prune-output "must have constant shape" } --5vNYLRcllDrimb99--