[Bug fortran/104352] ICE in gfc_conv_intrinsic_anyall, at fortran/trans-intrinsic.cc:4481 (etc.)
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 25 20:37:00 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104352
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-05-25
Priority|P3 |P4
Ever confirmed|0 |1
CC| |kargl at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #2 from kargl at gcc dot gnu.org ---
It make absolutely no sense to emit a warning when gfortran
detects an out-of-bounds array index. This patch fixes the
ICE and fixes the second error message to report that it is
the upper bound not the lower bound that errors out.
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 2ebf076f730..52a394db26a 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -4754,19 +4754,19 @@ check_dimension (int i, gfc_array_ref *ar,
gfc_array_spec *as)
{
if (compare_bound (AR_START, as->lower[i]) == CMP_LT)
{
- gfc_warning (0, "Lower array reference at %L is out of bounds "
+ gfc_error ("Lower array reference at %L is out of bounds "
"(%ld < %ld) in dimension %d", &ar->c_where[i],
mpz_get_si (AR_START->value.integer),
mpz_get_si (as->lower[i]->value.integer), i+1);
- return true;
+ return false;
}
if (compare_bound (AR_START, as->upper[i]) == CMP_GT)
{
- gfc_warning (0, "Lower array reference at %L is out of bounds "
+ gfc_error ("Upper array reference at %L is out of bounds "
"(%ld > %ld) in dimension %d", &ar->c_where[i],
mpz_get_si (AR_START->value.integer),
mpz_get_si (as->upper[i]->value.integer), i+1);
- return true;
+ return false;
}
}
More information about the Gcc-bugs
mailing list