https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98465
--- Comment #2 from Romain Geissler <romain.geissler at amadeus dot com> --- Hi Martin, Thanks for your investigation. I have a few questions: - Since the warning seems to be fully emitted by system headers, shouldn't it be silenced by default ? Why isn't it the case here ? On compiler explorer, "x86-64 gcc 10.2" and flags "-std=gnu++20 -O2" I get no warning, yet with flags "-std=gnu++20 -O2 -Wsystem-headers" I get a -Wstringop-overflow warning about the same problem. Meaning that for stringop-overflow system headers seems to be taken into account, but not for stringop-overread, is that expected ? - I understood why you did not reproduce the bug with gcc 11, my test case, and flags "-std=gnu++20 -O2". It looks like Compiler explorer forces "-g" by default. And it seems debug output generation does affect the warning. With flags "-std=gnu++20 -O2 -g0" (effectively disable debug information generation) I get no warning, while with "-std=gnu++20 -O2 -g" I get the stringop-overread warning. Again, gcc 10 doesn't seem to be impacted by debug output generation to trigger this warning, is this expected ? There seems to be a strange interaction between -Wsystem-headers and -g in gcc 11 which I don't understand. See the following matrix: - "-std=gnu++20 -O2 -Wno-system-headers -g0" --> no warning - "-std=gnu++20 -O2 -Wno-system-headers -g" --> warning - "-std=gnu++20 -O2 -Wsystem-headers -g0" --> warning - "-std=gnu++20 -O2 -Wsystem-headers -g" --> warning (this last matrix was tested on compiler explorer). I am confused. Cheers, Romain