Hi Thomas, >> I tested it on a fairly large code base and found no further false >> positives. Also it still regtests cleanly. Ok for trunk? > > > while I still disagree with this on principle, I will not stand > in the way.
IIUC you disagree in the sense that you would like gfortran to have more such optimizations (with more corresponding warnings). Is that correct? I hope you can at least agree that the warnings I'm adding in the patch are a) useful and b) sufficient for the current state of optimizations? Modifying gfortran's runtime behavior is really a separate question that we can continue to discuss later, probably with some amount of controversy. But before we even go there, I would really like to have warnings for the optimizations we have now ... > However, one point: I think that the warning should be under a separate > warning, which should then be enabled by -Wextra. > -Waggressive-function-elimination, could be reused for this, > or something else I don't actually see such a flag in the manual. I do see "-faggressive-function-elimination" (https://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html), but that is about changing runtime behavior, not about throwing warnings. Do you propose to couple the warning to -faggressive-function-elimination (and also the short-circuiting behavior itself)? Or do you propose to add a flag named -Waggressive-function-elimination? Cheers, Janus