https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81172

            Bug ID: 81172
           Summary: Improve -Warray-bounds for address arithmetic
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryxi at stu dot xidian.edu.cn
  Target Milestone: ---

The address arithmetics producing pointers out of the array bound
is undefined behaviour and should be warned by -Warray-bounds. For example

> int a[] = {1,2,3,4};
> int *p = a + 5;

and

> char s[] = "aaa", t[] = "bbbbb';
> const char *p = s + strlen(t);

and

> char s[] = "aaa" + 'c';

Reply via email to