https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94246

--- Comment #9 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Mon, Mar 23, 2020 at 07:29:02PM +0000, anlauf at gcc dot gnu.org wrote:
> --- Comment #7 from anlauf at gcc dot gnu.org ---
> I get an ICE even for the non-valgrind version on x86_64-pc-linux-gnu:
> 
> gcc/testsuite/gfortran.dg/bessel_5.f90:64:50:
> 
>    64 | if (any (BESSEL_YN(0, 10, 0.0) /= [ (BESSEL_YN(i, 0.0), i = 0, 10) ]))
> &
>       |                                                  1
> Error: Result of BESSEL_YN overflows its kind at (1)
> gcc/testsuite/gfortran.dg/bessel_5.f90:64:26:
> 
>    64 | if (any (BESSEL_YN(0, 10, 0.0) /= [ (BESSEL_YN(i, 0.0), i = 0, 10) ]))
> &
>       |                          1
> Error: Result of BESSEL_YN is -INF at (1)
> f951: internal compiler error: Segmentation fault

(snip)

> 
> I agree with Richard that this should not happen.
> 

1.  Fix the errors that are already emitted.  It won't happen.
2.  Use -fmax-errors = 1.  It won't happen.  -fmax-errors=1 should
    be the default.  Unfortunately, the GCC diagnosistic has usurped
    that option.
3.  Write correct Fortran.  It won't happen.
4.  Apply this patch.  Watch for cut-n-paste tab corruption.

ndex: gcc/fortran/arith.c
===================================================================
--- gcc/fortran/arith.c (revision 280157)
+++ gcc/fortran/arith.c (working copy)
@@ -1322,6 +1322,12 @@ reduce_binary_ac (arith (*eval) (gfc_expr *, gfc_expr 
   else
     {
       gfc_constructor *c = gfc_constructor_first (head);
+
+      if (!c)
+ gfc_fatal_error ("\"To handle a language skillfully is to "
+    "practice a kind of evocative sorcery.\" "
+    "Charles Baudelaire");
+
       r = gfc_get_array_expr (c->expr->ts.type, c->expr->ts.kind,
          &op1->where);
       r->shape = gfc_copy_shape (op1->shape, op1->rank);

Reply via email to