From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: HAO CHEN GUI <guihaoc@linux.ibm.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
fortran <fortran@gcc.gnu.org>,
Segher Boessenkool <segher@kernel.crashing.org>,
David <dje.gcc@gmail.com>, "Kewen.Lin" <linkw@linux.ibm.com>,
Peter Bergner <bergner@linux.ibm.com>
Subject: Re: [PATCH, gfortran] Escalate failure when Hollerith constant to real conversion fails [PR103628]
Date: Wed, 1 Mar 2023 07:39:40 -0800 [thread overview]
Message-ID: <Y/9xvOJpH7lpa/fD@troutmask.apl.washington.edu> (raw)
In-Reply-To: <c82181f1-333b-efc4-e297-2666866e8003@codesourcery.com>
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
next prev parent reply other threads:[~2023-03-01 15:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c4d05663-57a2-40be-3fba-270239b52ee0@linux.ibm.com>
2023-03-01 9:40 ` Tobias Burnus
2023-03-01 15:39 ` Steve Kargl [this message]
2023-03-02 0:07 ` Bernhard Reutner-Fischer
2023-03-02 1:10 ` Steve Kargl
2023-03-02 0:00 ` Bernhard Reutner-Fischer
2023-03-02 2:27 ` Kewen.Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/9xvOJpH7lpa/fD@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=guihaoc@linux.ibm.com \
--cc=linkw@linux.ibm.com \
--cc=segher@kernel.crashing.org \
--cc=tobias@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).