public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/109684] compiling failure: complaining about a final subroutine of a type being not PURE (while it is indeed PURE)
Date: Mon, 07 Aug 2023 22:04:54 +0000	[thread overview]
Message-ID: <bug-109684-4-crIKRaRMBK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109684-4@http.gcc.gnu.org/bugzilla/>

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
           Priority|P3                          |P4

--- Comment #10 from kargl at gcc dot gnu.org ---
(In reply to Neil Carlson from comment #9)
> Bug is still present in 13.2.0.

class.cc(generate_finalization_wrapper) contains the following

  /* Set up the procedure symbol.  */
  name = xasprintf ("__final_%s", tname);
  gfc_get_symbol (name, sub_ns, &final);
  sub_ns->proc_name = final;
  final->attr.flavor = FL_PROCEDURE;
  final->attr.function = 1;
  final->attr.pure = 0;
  final->attr.recursive = 1;
  final->result = final;
  final->ts.type = BT_INTEGER;
  final->ts.kind = 4;
  final->attr.artificial = 1;


Note final->attr.pure = 0 seems to contradict C1595 while constructing
the wrapper.  I'm not too familiar with this portion of gfortran's
internals.  Either the attribute should be set to 1 or the error
message can be suppressed through inspection of final->attr.artificial.


diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 3cd470ddcca..b0bb8bc1471 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -17966,7 +17966,9 @@ resolve_types (gfc_namespace *ns)

   for (n = ns->contained; n; n = n->sibling)
     {
-      if (gfc_pure (ns->proc_name) && !gfc_pure (n->proc_name))
+      if (gfc_pure (ns->proc_name)
+         && !gfc_pure (n->proc_name)
+         && !n->proc_name->attr.artificial)
        gfc_error ("Contained procedure %qs at %L of a PURE procedure must "
                   "also be PURE", n->proc_name->name,
                   &n->proc_name->declared_at);

pault, dos the above look correct?

  parent reply	other threads:[~2023-08-07 22:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 13:39 [Bug fortran/109684] New: " wangmianzhi1 at linuxmail dot org
2023-05-17 14:44 ` [Bug fortran/109684] " wangmianzhi1 at linuxmail dot org
2023-05-22  6:33 ` trnka at scm dot com
2023-05-22  6:36 ` trnka at scm dot com
2023-05-22  6:39 ` trnka at scm dot com
2023-05-23 16:53 ` pault at gcc dot gnu.org
2023-05-24 10:05 ` pault at gcc dot gnu.org
2023-05-24 10:13 ` trnka at scm dot com
2023-05-24 12:37 ` neil.n.carlson at gmail dot com
2023-08-07 20:39 ` neil.n.carlson at gmail dot com
2023-08-07 22:04 ` kargl at gcc dot gnu.org [this message]
2023-08-07 22:23 ` sgk at troutmask dot apl.washington.edu
2023-08-07 22:58 ` sgk at troutmask dot apl.washington.edu
2023-08-08 13:27 ` pault at gcc dot gnu.org
2023-08-09  2:29 ` kargl at gcc dot gnu.org
2023-08-09  7:58 ` pault at gcc dot gnu.org
2023-08-09  8:11 ` pault at gcc dot gnu.org
2023-08-09 10:08 ` trnka at scm dot com
2023-08-09 11:04 ` cvs-commit at gcc dot gnu.org
2023-08-09 14:54 ` cvs-commit at gcc dot gnu.org
2023-08-09 14:56 ` pault at gcc dot gnu.org
2023-08-09 15:37 ` sgk at troutmask dot apl.washington.edu
2023-08-09 16:19 ` trnka at scm dot com
2023-08-09 16:59 ` sgk at troutmask dot apl.washington.edu
2023-11-06 15:34 ` trnka at scm dot com
2023-11-06 18:40 ` sgk at troutmask dot apl.washington.edu

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-109684-4-crIKRaRMBK@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).