[Bug sanitizer/101300] New: -fsanitize=undefined suppresses -Wuninitialized
llvm at rifkin dot dev
gcc-bugzilla@gcc.gnu.org
Fri Jul 2 14:57:32 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101300
Bug ID: 101300
Summary: -fsanitize=undefined suppresses -Wuninitialized
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: llvm at rifkin dot dev
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: ---
The following code should produce a Wuninitialized warning.
int foo() {
int n = 4;
char b[n];
return b[2];
}
The compiler identifies the uninitialized access when compiled -Wall however it
does not when compiled with -Wall -fsanitize=undefined.
It does warn properly when compiled with -Wall -fsanitize=undefined -O1 (or any
optimization flag other than -O0).
https://godbolt.org/z/4rrKK5MYj
More information about the Gcc-bugs
mailing list