From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by sourceware.org (Postfix) with ESMTPS id 569003858D33; Wed, 1 Mar 2023 15:44:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 569003858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: sourceware.org; spf=none smtp.mailfrom=troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.17.1/8.17.1) with ESMTPS id 321Fdf72072080 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 1 Mar 2023 07:39:41 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.17.1/8.17.1/Submit) id 321Fdeui072079; Wed, 1 Mar 2023 07:39:40 -0800 (PST) (envelope-from sgk) Date: Wed, 1 Mar 2023 07:39:40 -0800 From: Steve Kargl To: Tobias Burnus Cc: HAO CHEN GUI , gcc-patches , fortran , Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner Subject: Re: [PATCH, gfortran] Escalate failure when Hollerith constant to real conversion fails [PR103628] Message-ID: Reply-To: sgk@troutmask.apl.washington.edu References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Mar 01, 2023 at 10:40:15AM +0100, Tobias Burnus wrote: > > --- /dev/null > > +++ b/gcc/testsuite/gfortran.dg/pr103628.f90 > > @@ -0,0 +1,14 @@ > > +! { dg-do compile { target powerpc*-*-* } } > > +! { dg-options "-O2 -mabi=ibmlongdouble" } > > + > > +! Test to ensure that it reports an "Unclassifiable statement" error > > +! instead of throwing an ICE when the memory represent of the HOLLERITH > > +! string is not unique with ibm long double encoding. > > ... > > + real(kind = k):: b = 4h1234 This should be rejected with an error message. Hollerith was deleted from Fortran in Appendix C-1 of the Fortran 77 standard. The appearance of a Hollerith entity in an initialization expression has never be conforming. In fact, Hollerith should be hidden behind a -fallow-hollerith option and added to -std=legacy. > diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc > index 64821c84543..b60d92a0665 100644 > --- a/gcc/fortran/intrinsic.cc > +++ b/gcc/fortran/intrinsic.cc > @@ -27,2 +27,3 @@ along with GCC; see the file COPYING3. If not see > #include "intrinsic.h" > +#include "diagnostic.h" /* For errorcount. */ > > @@ -4622,2 +4623,3 @@ do_simplify (gfc_intrinsic_sym *specific, gfc_expr *e) > gfc_actual_arglist *arg; > + int old_errorcount = errorcount; > > @@ -4710,3 +4712,7 @@ finish: > if (result == &gfc_bad_expr) > - return false; > + { > + if (errorcount == old_errorcount) > + gfc_error ("Cannot simplify expression at %L", &e->where); > + return false; > + } I'm okay with this suggestion. -- Steve