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/100274] [9/10/11/12 Regression] ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131
Date: Tue, 27 Apr 2021 20:39:21 +0000	[thread overview]
Message-ID: <bug-100274-4-GbT4h4DMkR@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100274-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
The patch in comment#1 would turn the ICE into an accepts-invalid, since
we would only get a warning instead of an error.  This happens because
the character length check in gfc_compare_actual_formal returns too early
after emitting the warning.

The simplest fix would be to continue doing the checking:

diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 60736123550..9e3e8aa9da9 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -3255,10 +3255,13 @@ gfc_compare_actual_formal (gfc_actual_arglist **ap,
gfc_formal_arglist *formal,
          && f->sym->attr.flavor != FL_PROCEDURE)
        {
          if (a->expr->ts.type == BT_CHARACTER && !f->sym->as && where)
-           gfc_warning (0, "Character length of actual argument shorter "
-                        "than of dummy argument %qs (%lu/%lu) at %L",
-                        f->sym->name, actual_size, formal_size,
-                        &a->expr->where);
+           {
+             gfc_warning (0, "Character length of actual argument shorter "
+                          "than of dummy argument %qs (%lu/%lu) at %L",
+                          f->sym->name, actual_size, formal_size,
+                          &a->expr->where);
+             goto skip_size_check;
+           }
           else if (where)
            {
              /* Emit a warning for -std=legacy and an error otherwise. */

This regtests cleanly and allows to emit the same error message as for
matching character length.

  parent reply	other threads:[~2021-04-27 20:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 19:48 [Bug fortran/100274] New: " gscfq@t-online.de
2021-04-26 21:00 ` [Bug fortran/100274] " anlauf at gcc dot gnu.org
2021-04-27 20:39 ` anlauf at gcc dot gnu.org [this message]
2021-04-27 20:57 ` anlauf at gcc dot gnu.org
2021-05-05 13:26 ` cvs-commit at gcc dot gnu.org
2021-05-05 19:00 ` cvs-commit at gcc dot gnu.org
2021-05-05 19:40 ` cvs-commit at gcc dot gnu.org
2021-05-05 19:55 ` cvs-commit at gcc dot gnu.org
2021-05-05 19:59 ` anlauf 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-100274-4-GbT4h4DMkR@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: link
Be 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).