[Bug fortran/106209] ICE in add_init_expr_to_sym, at fortran/decl.cc:2132
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 5 19:21:09 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106209
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-07-05
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |kargl at gcc dot gnu.org
Priority|P3 |P4
--- Comment #1 from kargl at gcc dot gnu.org ---
Instead of an assert(), simply return false to give gfortran a chance to emit
an error.
% gfcx -c a.f90
a.f90:3:4:
3 | integer, parameter :: b(*) = a
| 1
Error: Unclassifiable statement at (1)
a.f90:2:29:
2 | integer, parameter :: a(:) = 0
| 1
Error: Parameter array 'a' at (1) cannot be automatic or of deferred shape
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index bd586e75008..cec178fc80b 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -2129,7 +2129,9 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp,
locus *var_locus)
/* The shape may be NULL for EXPR_ARRAY, set it. */
if (init->shape == NULL)
{
- gcc_assert (init->expr_type == EXPR_ARRAY);
+ if (init->expr_type != EXPR_ARRAY)
+ return false;
+
init->shape = gfc_get_shape (1);
if (!gfc_array_size (init, &init->shape[0]))
gfc_internal_error ("gfc_array_size failed");
More information about the Gcc-bugs
mailing list