Closed kmurray closed 5 years ago
@mithro FYI
I think the best practical option is to turn these warnings off globally during the link phase. Maybe we miss a useful warning (bad), but we get rid of the spurious warnings (which are worse as they'll teach everyone to ignore these warnings).
Should be fixed as of 4b56960b2.
We now provide the -Wno-null-dereference
option (if supported by the compiler) at link time to the relevant executables when built with IPO.
This should ensure that we build warning clean (at least with GCC) even when IPO is enabled.
Expected Behaviour
VTR should compile warning clean with gcc and Inter-Procedural/Link-Time Optimization (IPO/LTO).
Current Behaviour
VPR compiles warning clean when
VTR_IPO_BUILD=off
(i.e. without IPO which is not the default). While most of our code is warning clean there are some files which we do not control which are not. In particular:To handle this we have historically disabled all warnings (pugixml) or the specific offending warnings (flex/bison).
However with IPO enabled, warnings similar to the following (from VPR) are produced at link time:
Possible Solution
Not clear, it seems when run with LTO warning suppression options which were applied to specific source files are not carried over during linking. This is perhaps not so surprising since LTO breaks the historical single compilation unit model.
However it seems like GCC should really respect the warning flags when the source file was originally compiled even when doing LTO, so perhaps this is really a GCC bug.
Previously this was not an issue as we only applied LTO to vpr, but that caused crashes in GCC (#628), and the fix now causes all code (including the pugixml, libblifparse, and libsdcparse) to be built with LTO exposing this issue.
Steps to Reproduce
CC=gcc-9 CXX=g++-9 make
Context
Keeping the code compiling with no warnings is important for code quality as it ensures newly introduced warnings about suspect code are immediately noticed.
Your Environment