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/107995] ICE: Segmentation fault, without backtrace
Date: Sat, 10 Dec 2022 19:37:06 +0000	[thread overview]
Message-ID: <bug-107995-4-yPkpPcaTQm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107995-4@http.gcc.gnu.org/bugzilla/>

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

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)
> This patch prevents the ICE.

The patch is mostly good, but does not set the errmsg variable, which
leads to garbage in the printed error message.

We could do the following (haven't found a better one yet):

diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index 73799c175b7..ad4182a01ae 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -1334,6 +1334,12 @@ gfc_check_dummy_characteristics (gfc_symbol *s1,
gfc_symbol *s2,
   if (s1 == NULL || s2 == NULL)
     return s1 == s2 ? true : false;

+  if (s1->attr.proc == PROC_ST_FUNCTION || s2->attr.proc == PROC_ST_FUNCTION)
+    {
+      strncpy (errmsg, "Statement function", err_len);
+      return false;
+    }
+
   /* Check type and rank.  */
   if (type_must_agree)
     {

This prints:

pr107995-z1.f90:4:3:

    4 |   n(n) = 1
      |   1
Error: Self-referential argument 'n' at (1) is not allowed
pr107995-z1.f90:5:13:

    5 |   print *, n(n)
      |             1
Error: Statement function 'n' at (1) is not allowed as an actual argument
pr107995-z1.f90:5:13:

    5 |   print *, n(n)
      |             1
Error: Interface mismatch in dummy procedure 'n' at (1): Statement function

  parent reply	other threads:[~2022-12-10 19:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 18:06 [Bug fortran/107995] New: " gscfq@t-online.de
2022-12-10  2:19 ` [Bug fortran/107995] " kargl at gcc dot gnu.org
2022-12-10 19:37 ` anlauf at gcc dot gnu.org [this message]
2022-12-10 21:05 ` sgk at troutmask dot apl.washington.edu
2022-12-10 21:24 ` anlauf at gcc dot gnu.org
2022-12-11 19:35 ` cvs-commit at gcc dot gnu.org
2022-12-12 20:23 ` anlauf at gcc dot gnu.org
2022-12-12 21:43 ` sgk at troutmask dot apl.washington.edu
2022-12-12 21:49 ` 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-107995-4-yPkpPcaTQm@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).