This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/80797] New: -fsanitize=null doesn't instrument &s->x
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 17 May 2017 07:31:40 +0000
- Subject: [Bug sanitizer/80797] New: -fsanitize=null doesn't instrument &s->x
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80797
Bug ID: 80797
Summary: -fsanitize=null doesn't instrument &s->x
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
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: ---
Discovered in PR80768:
struct S
{
int i;
};
int
main ()
{
struct S *s = 0;
int *v = &s->i;
int *v2 = &(*s).i;
return 0;
}
is not instrumented by gcc, but is by clang:
s.c:10:16: runtime error: member access within null pointer of type 'struct S'
s.c:11:14: runtime error: member access within null pointer of type 'struct S'