https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81981
Bug ID: 81981 Summary: [8 Regression] -fsanitize=undefined makes a -Wmaybe-uninitialized warning disappear Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- Consider: int foo (int i) { int t[1], u[1]; int n = 0; if (i) { t[n] = i; u[0] = i; } return t[0] + u[0]; } With gcc (Debian 20170823-1) 8.0.0 20170823 (experimental) [trunk revision 251306], I get: zira% gcc-snapshot -Wmaybe-uninitialized -O2 -c tst.c -fsanitize=undefined tst.c: In function 'foo': tst.c:12:15: warning: 'u[0]' may be used uninitialized in this function [-Wmaybe-uninitialized] return t[0] + u[0]; ~~~~~^~~~~~ zira% gcc-snapshot -Wmaybe-uninitialized -O2 -c tst.c tst.c: In function 'foo': tst.c:12:15: warning: 'u[0]' may be used uninitialized in this function [-Wmaybe-uninitialized] return t[0] + u[0]; ~~~~~^~~~~~ tst.c:12:15: warning: 't[0]' may be used uninitialized in this function [-Wmaybe-uninitialized] i.e. with -fsanitize=undefined, I do not get the warning on t[0]. This is a regression. No such problem with GCC 7.2.0, 6.4.0 and 5.4.1.