public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikael 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: Sun, 11 Aug 2013 11:34:00 -0000	[thread overview]
Message-ID: <bug-44978-4-8ipSZE3BhO@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 #14 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to janus from comment #13)
> > > Well, the advantage of my original patch is obviously that it not only
> > > avoids the double errors, but it also prevents us from doing double the work
> > > in resolving the symbols, so it might even give a performance improvement
> > > for large codes, in particular with heavy OOP (not sure if it's anywhere
> > > close to being significant, though).
> > 
> > All right, the only one solution left that I see is the one making the
> > functions void. See the attached patch (comments welcome).
> > I ran the testsuite partially on it and it was clean, but I don't have the
> > time to finish that right now. It looked as slow as usual by the way. ;-)
> 
> Your patch does not compile cleanly, but after a small fix to make it
> compile, the testsuite runs through successfully. 

Uh? My trunk is a few weeks old. I guess that's the reason.

> However, I don't quite see the point of doing this: Doesn't a void return
> value have basically the same effect as returning true? (i.e. to "keep
> going", whereas returning false means to "back out", since there was a
> problem)
> 
The point is: if the return value is not reliable, let's remove it.

The void is indeed the same as returning true ("keep going"). I think it's
better to "always keep going" rather than "keep going because the function was
already called, even if it returned 'back out' the first time".

> Therefore I don't really see the improvement here. To the contrary: I would
> rather say we should propagate the return values as far as possible (one
> case where it is currently not propagated is resolve_symbol). This alone
> might even get rid of the double errors (if one pulls it through fully), but
> again it does not really help with double resolution in the non-error case,
> so I'd say we still need to rely on sym->resolved.
> 
OK, let's use more bool; but then the return value shall be consistent across
multiple calls.
So I would say use two bits for each function: one telling whether the function
was already called on the symbol, and one telling the return value.
There are three functions as far as I know (resolve_symbol, resolve_fl_derived
and resolve_fl_derived0) which makes six bits.
Even if you are concerned about wasted memory, that doesn't consume extra
memory because of fields alignments.


(In reply to Mikael Morin from comment #10)
> > Or can
> > you give an example where it would create a problem?
> 
> No, it was more a general design comment. I will try to find one.

I couldn't find one; but my opinion remains the same. I think it's bad design
to return different values across repeated calls.


  parent reply	other threads:[~2013-08-11 11:34 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
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 [this message]
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-8ipSZE3BhO@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).