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.