Hi Mikael, >> I have just committed as obvious a one-line-removal patch which fixes >> a wrong-code OOP regression: >> >> http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=206281 >> > Sometimes computer programming is more witchcraft than (computer) science. > You add some code, it fixes a bug. > Now you remove it, it also fixes this one. > Huh?
well, if you look at the behavior of the test cases in the PR, there is definitely some sort of black magic involved here ;) Anyway, removing unneeded code is a pretty neat way to fix a bug. (I checked that removing the code does not re-introduce the original problem, for which it was inserted back then.) To be honest, the vtab generation was never fully systematic, but mostly followed the principle that we just generate one whenever we need one (of course always checking that it isn't present already). >> Since the regression also affects 4.8, I would like to backport the >> patch (after waiting a few days and letting the reporter try the fix >> on his original code). Ok if no problems appear on trunk? >> > OK with me. I would be delighted to understand why it works. AFAICS, the problem was somehow related to the fact that we were apparently building two instances of the vtab symbol for the derived type 'TestResult'. But I have to admit that I did not investigate in detail how that could lead to the observed behavior. Possibly it was combined with some other problem, or at least obfuscated by the delicacies of module loading and/or resolution order etc. In any case, we apparently end up with two versions of the vtab, and the one that is being used probably has not been properly initialized or something like that. Cheers, Janus