public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/44978] derived types are resolved more than once
Date: Fri, 09 Aug 2013 06:00:00 -0000 [thread overview]
Message-ID: <bug-44978-4-uCcB1xHUUU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-44978-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44978
--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
> To get rid of all of them, I would propose to use the gfc_symbol.resolved
> field (this is already done for ordinary symbols in 'resolve_symbol'). For
> derived types, however, one may have to add another value of this flag
> (other than '0' and '1') to distinguish between the two different resolution
> levels of resolve_fl_derived0 vs resolve_fl_derived.
The following draft patch does exactly this and gets the error count down to
one for comment 1 and down to two for comment 1 and 4:
Index: gcc/fortran/gfortran.h
===================================================================
--- gcc/fortran/gfortran.h (revision 201576)
+++ gcc/fortran/gfortran.h (working copy)
@@ -1250,7 +1250,7 @@ typedef struct gfc_symbol
/* Set if this variable is used as an index name in a FORALL. */
unsigned forall_index:1;
/* Used to avoid multiple resolutions of a single symbol. */
- unsigned resolved:1;
+ unsigned resolved:2;
int refs;
struct gfc_namespace *ns; /* namespace containing this symbol */
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 201576)
+++ gcc/fortran/resolve.c (working copy)
@@ -11962,6 +11962,10 @@ resolve_fl_derived0 (gfc_symbol *sym)
gfc_symbol* super_type;
gfc_component *c;
+ if (sym->resolved>1)
+ return true;
+ sym->resolved = 2;
+
if (sym->attr.unlimited_polymorphic)
return true;
@@ -12381,6 +12385,13 @@ resolve_fl_derived (gfc_symbol *sym)
{
gfc_symbol *gen_dt = NULL;
+ if (!resolve_fl_derived0 (sym))
+ return false;
+
+ if (sym->resolved>2)
+ return true;
+ sym->resolved = 3;
+
if (sym->attr.unlimited_polymorphic)
return true;
@@ -12422,9 +12433,6 @@ resolve_fl_derived (gfc_symbol *sym)
}
}
- if (!resolve_fl_derived0 (sym))
- return false;
-
/* Resolve the type-bound procedures. */
if (!resolve_typebound_procedures (sym))
return false;
@@ -12624,16 +12632,13 @@ resolve_symbol (gfc_symbol *sym)
gfc_array_spec *as;
bool saved_specification_expr;
- if (sym->resolved)
+ if (sym->resolved>0)
return;
sym->resolved = 1;
- if (sym->attr.artificial)
+ if (sym->attr.artificial || sym->attr.unlimited_polymorphic)
return;
- if (sym->attr.unlimited_polymorphic)
- return;
-
if (sym->attr.flavor == FL_UNKNOWN
|| (sym->attr.flavor == FL_PROCEDURE && !sym->attr.intrinsic
&& !sym->attr.generic && !sym->attr.external
next prev parent reply other threads:[~2013-08-09 6:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-44978-4@http.gcc.gnu.org/bugzilla/>
2013-04-13 11:15 ` [Bug fortran/44978] extended " janus at gcc dot gnu.org
2013-06-15 11:12 ` dominiq at lps dot ens.fr
2013-08-08 20:00 ` [Bug fortran/44978] " janus at gcc dot gnu.org
2013-08-08 21:24 ` janus at gcc dot gnu.org
2013-08-09 6:00 ` janus at gcc dot gnu.org [this message]
2013-08-09 13:37 ` janus at gcc dot gnu.org
2013-08-09 13:59 ` janus at gcc dot gnu.org
2013-08-09 15:03 ` mikael at gcc dot gnu.org
2013-08-09 19:23 ` janus at gcc dot gnu.org
2013-08-09 19:55 ` mikael at gcc dot gnu.org
2013-08-10 7:55 ` janus at gcc dot gnu.org
2013-08-11 8:54 ` janus at gcc dot gnu.org
2013-08-11 11:34 ` mikael at gcc dot gnu.org
2013-08-11 17:22 ` janus at gcc dot gnu.org
2013-08-11 19:12 ` mikael at gcc dot gnu.org
2013-08-13 9:38 ` dominiq at lps dot ens.fr
2013-08-13 9:40 ` dominiq at lps dot ens.fr
2013-08-13 9:54 ` dominiq at lps dot ens.fr
2013-08-13 14:14 ` dominiq at lps dot ens.fr
2015-01-15 18:44 ` janus 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-44978-4-uCcB1xHUUU@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).