public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106209] ICE in add_init_expr_to_sym, at fortran/decl.cc:2132 Date: Thu, 14 Jul 2022 19:35:21 +0000 [thread overview] Message-ID: <bug-106209-4-yx0RJUDIEO@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106209-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106209 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #2 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #1) > Instead of an assert(), simply return false to give gfortran a chance to > emit an error. Steve, your patch does fix z1, but not z2, which hits the gfc_internal_error ("gfc_array_size failed"); a few lines later... The following adjusted patch fixes the latter, too, regtests cleanly, and gives nicer error messages :) diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index 339f8b15035..b6400514731 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -2129,10 +2129,21 @@ 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) + { + gfc_error ("Bad shape of initializer at %L", &init->where); + return false; + } + init->shape = gfc_get_shape (1); if (!gfc_array_size (init, &init->shape[0])) - gfc_internal_error ("gfc_array_size failed"); + { + gfc_error ("Cannot determine shape of initializer at %L", + &init->where); + free (init->shape); + init->shape = NULL; + return false; + } } for (dim = 0; dim < sym->as->rank; ++dim)
next prev parent reply other threads:[~2022-07-14 19:35 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-05 18:49 [Bug fortran/106209] New: " gscfq@t-online.de 2022-07-05 19:21 ` [Bug fortran/106209] " kargl at gcc dot gnu.org 2022-07-14 19:35 ` anlauf at gcc dot gnu.org [this message] 2022-07-14 20:17 ` sgk at troutmask dot apl.washington.edu 2022-07-14 20:27 ` cvs-commit at gcc dot gnu.org 2022-07-14 20:36 ` anlauf at gcc dot gnu.org 2023-01-28 22:03 ` cvs-commit at gcc dot gnu.org 2023-02-04 15:43 ` cvs-commit at gcc dot gnu.org 2023-02-05 18:55 ` cvs-commit at gcc dot gnu.org
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=bug-106209-4-yx0RJUDIEO@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).