On 23 March 2018 at 17:47, Vadim Zeitlin wrote: > Hello, > > I'm running into a rather crazy problem that I can't minimize enough to > create a bug report for, so I'd like to ask here if anybody might have any > ideas about it by chance. The problem is that the behaviour of some piece > of C++ code changes, when compiling using MinGW g++ 7.2 (20180123 version > from Debian Buster) and "-O2", depending on whether _both_ of -Wall and > -Woverloaded-virtual command line options are specified or not. I.e. the > code behaves in the same way (and the generated assembly is identical) when > compiling with just "-O2", or with "-O2 -Wall", or with "-O2 > -Woverloaded-virtual", but when all of "-O2 -Wall -Woverloaded-virtual" are > used, the code behaviour changes (it's a unit test and it starts failing) > and the assembly for the functions in which the test fails looks very > different. > > Unfortunately I can't reduce the program to anything reasonably small as > just about any changes to the source file, including to the clearly > unrelated stuff, make the bug disappear. I've tried using delta tool > recommended by gcc wiki, but it didn't produce anything useful after > running for many hours (it reduced the test case from 85801 initial lines > of preprocessed code to ~67000, which is not really very useful...). > > Does anyone know what else could I try doing? Or maybe someone already > knows how does the combination of these 2 warning switches affect the code > generation (which is something I'd naïvely expect to be impossible)? Have you already tried -fsanitize=undefined and the other suggestions at https://gcc.gnu.org/bugs/ ?