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

Reply via email to