Re[5]: Using -Wall and -Woverloaded-virtual together changes the behaviour of the code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 23 Mar 2018 22:34:03 +0300 (MSK) Alexander Monakov <amonakov@xxxxxxxxx> wrote:

AM> On Fri, 23 Mar 2018, Vadim Zeitlin wrote:
AM> >  Yet they definitely do. I may not have a SSCCE of it, but building 4
AM> > versions of the same object file/executable that differ only in the warning
AM> > options used:
AM> > 
AM> > 1. Both -Wall and -Woverloaded-virtual
AM> > 2. Only -Wall
AM> > 3. Only -Woverloaded-virtual
AM> > 4. Neither
AM> 
AM> Since -Wall enables many individual warning options (you can see the list
AM> by supplying -Wall -Q --help=warnings on gcc command line), to investigate
AM> further you can try to find a minimal subset of -Wall that still exhibits
AM> the issue.

 Thanks for the idea and the hint (I didn't know about the -Q option)! I
did this and it turns out the culprit is "-Wnonnull": using it with
"-Woverloaded-virtual" changes the generated code, while using all the
other options included in -Wall doesn't.

 Looking at gcc sources, this seems completely impossible as
OPT_Woverloaded_virtual is only used once in gcc/cp/class.c and this
clearly can't affect anything else. Yet somehow it does...


AM> >  Would you have any idea about how could this be explained?
AM> 
AM> By all indications this is an unusual compiler bug. Please file a report
AM> in GCC Bugzilla if you can, even if the testcase has a large line count.

 I made another attempt to use delta and it managed to produce a "just" 771
line file reproducing the problem, but I discovered another impossible
thing while doing this: not only the generated code depends on the warnings
options, but it also somehow depends on the name of the input file! Delta
finished by producing a file tmp1/16795.cpp, yet when I tested it manually,
the file didn't pass the check, i.e. compiling it with and without warning
options produced the same object file. It looked like a bug in delta
itself, so I've started debugging it and while doing it noticed that it
always runs the test script with input.cpp as argument, and not the final
file name. And, surprise, renaming the *same* file to input.cpp indeed
makes the code generated from it when [not] using warning options
different...

 This really looks like a bad bug due to using uninitialized memory
somewhere in gcc itself. The only question is whether it's a problem of the
particular gcc build I'm using or not.

 Anyhow, I've created https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85091
now, please let me know if I can do anything else here.

 Thanks,
VZ

Attachment: pgp6LDyhmMMdL.pgp
Description: PGP signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux