From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26664 invoked by alias); 11 Aug 2013 08:54:01 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26624 invoked by uid 48); 11 Aug 2013 08:53:58 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/44978] derived types are resolved more than once Date: Sun, 11 Aug 2013 08:54:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.6.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: janus at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00588.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44978 --- Comment #13 from janus at gcc dot gnu.org --- (In reply to Mikael Morin from comment #12) > > IMHO it is probably not worth the hassle. I wouldn't like to do this without > > having a concrete reason for it (and with a clean testsuite I don't see any). > > > The reason is: > the sym->resolved flag is an internal detail that should not be externally > visible; it shouldn't change the return value. well, I guess one could argue that the return value of 'resolve_fl_derived' is an internal detail in the same sense as sym->resolved (both are not directly 'user-visible'). > > 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. (Btw I would not really expect a visible performance effect in the testsuite, because the share of OOP code in there is probably still rather low, even if it's growing slowly.) 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) 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. But in addition (as a follow-up?) it might be worth to use more bool return values instead of void in the resolve_* routines (e.g. resolve_symbol). IIRC there might even be a another PR where this helps (will see if I can still find it ...)