From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6342 invoked by alias); 10 Mar 2018 05:13:14 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 6322 invoked by uid 89); 10 Mar 2018 05:13:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=cures 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; Sat, 10 Mar 2018 05:13:13 +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 w2A5DB1K035554 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 9 Mar 2018 21:13:11 -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 w2A5DBiu035553; Fri, 9 Mar 2018 21:13:11 -0800 (PST) (envelope-from sgk) Date: Sat, 10 Mar 2018 05:13:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR fortran/84734 -- Fix ICE on invalid code Message-ID: <20180310051310.GA35527@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00026.txt.bz2 In fixing PR fortran/83633, it seems the patch I committed introduced an ICE for nonsensical invalid Fortran. The attached patch cures the ICE and now (re)issues an error message. The basic problem seems to boil down to the recursive calling of gfc_simplify_expr reduces "huge(1_8)+1_8" to "constant + constant". When the chain of gfc_simplify_expr tries to reduces this expression an overflow occurs. An error message is queud but never emitted, and the result is set to NULL and both constants are freed. The NULL is passed back up through the chain of gfc_simplify_expr. At some point that NULL pointer is referenced. The patch works around the problem by passing the result with the overflow value up the chain. Regression tested on x86_64-*-freebsd. I intend to commit this patch tomorrow, which on my clock is only 2.75 hours away. 2018-03-09 Steven G. Kargl PR fortran/84734 * arith.c (check_result, eval_intrinsic): If result overflows, pass the expression up the chain instead of a NULL pointer. 2018-03-09 Steven G. Kargl PR fortran/84734 * gfortran.dg/pr84734.f90: New test. -- Steve