This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/80797] New: -fsanitize=null doesn't instrument &s->x


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'

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]