On Sun, Feb 17, 2019 at 8:19 PM Thomas Koenig <tkoe...@netcologne.de> wrote: > > Hello world, > > the attached patch fixes a rather bad ABI violation on POWER systems. > > In the absence of an explicit interface and if a procedure is not in > the same file, gfortran currently generates wrong function decls - > a longstanding problem that also creates problems with LTO, because > it (correctly) complains about mismatched declarations. > > Usually, we got lucky because the actual calling sequences generated > by the compiler with the wrong info happened to match the ones > with the correct info. However, our luck ran out on POWER because > as soon as arguments were passed in memory, things did not work > any more. The test case in question (see attachments) produced > wrong code on POWER, but merely warned with LTO on other systems. > > The method for solving this problem can be seen in the patch - if > there is no backend decl for an external procedure, simply generate > a formal argument list from the arguments. > > Regression tests turned up a few ICEs (now fixed), plus two > very invalid test cases, which I think are not worth saving. > > I suspect that this will also fix a few LTO bugs, but we can always > check that after this has been committed. > > I'd still like confirmation from one of the POWER people that > this also fixes the bug on that architecture. > > Should this still go into gcc-9? Richard has indicated in the > PR that he thinks so. I think so too, because of the severity > of the bug(s) this fixes. Any bugs resulting from this could > be either a) ICE-on-valid (easily fixed) or b) somehow generating > a wrong decl, but we are already doing this as of this moment, > so things can not really be made much worse, and a lot better. > > So, ok for trunk and for backport (with some time in between) > once gcc-8 has re-opened?
I agree, although we're close to the GCC-9 release, it's better to get this in now. So Ok. I wonder if we shouldn't exorcise all the varargs stuff, it seems to cause more problems than benefits? But not in stage4 if we can avoid it.. -- Janne Blomqvist