On Fri, 23 Mar 2018 18:18:33 +0000 Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: JW> On 23 March 2018 at 18:16, Vadim Zeitlin wrote: JW> > Just to be clear, this is what bothers me the most: how can these warnings JW> > options affect the optimizer output? Shouldn't this be "impossible"? JW> JW> Yes, they should have no effect on the generated code. Yet they definitely do. I may not have a SSCCE of it, but building 4 versions of the same object file/executable that differ only in the warning options used: 1. Both -Wall and -Woverloaded-virtual 2. Only -Wall 3. Only -Woverloaded-virtual 4. Neither and then disassembling the output (I even used both objdump and gdb, just to be sure) I see that the versions (2), (3) and (4) are completely identical, but (1) is very different, e.g. the function starts by allocating 16 fewer bytes for its local variables (just looking at the "sub esp, NNN" instruction in the prologue) and then things just diverge in many different ways. The same behaviour can be observed on different machines (even located on different continents, so it's not some local anomaly :-), so it's not just something weird going on this particular computer. I also don't think I'm crazy even if, I admit, the idea did cross my mind more than once while trying to debug this. Would you have any idea about how could this be explained? VZ
Attachment:
pgpRK5naFvzbS.pgp
Description: PGP signature