https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119388
Bug ID: 119388 Summary: [12/13/14/15 Regression] -isystem does not disable warnings coming from system headers Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dangelog at gmail dot com Target Milestone: --- When upgrading from GCC 11 to 13/14, some warnings start to appear from headers that have been included via -isystem. A minimal example would be creating a header containing this: #include <iostream> class Stuff { int x; public: Stuff() { std::cout << x; } }; And then including it via -isystem, and creating a Stuff object somewhere. Under -O2 -Wall -Wextra this yields on GCC 14: /app/my_includes/stuff.h:9:28: warning: 's.Stuff::x' is used uninitialized [-Wuninitialized] 9 | Stuff() { std::cout << x; } Whereas nothing was emitted on GCC 11. I've assembled a somehow more flexible example here on Godbolt: https://gcc.godbolt.org/z/c1Ts3ze87 You can play with: - different GCC versions / compiler option (anything above 11 will trigger the warning; 11 will as well, if disabling system headers) - the `#pragma GCC system_header` - setting SYSTEM in the CMakeLists.txt (so that CMake uses -isystem) - disabling inlining of f() into main() (which will suppress a second warning) In projects using Qt we're randomly seeing this for optimization-related warnings: -Wnull-dereference, -Wstrict-overflow, -Wmaybe-uninitialized. Some degree of optimization seems to be necessary. Apologies, it's highly probable that there could be duplicates of this, but bugzilla's search isn't really the best.