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

--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> ---
I got a case3 from Wstringop-overflow-76.c

#define MAX(p, q) ((p) > (q) ? (p) : (q))
struct B4_B6
{
  char b4[4];
  char b6[6];       // { dg-message "at offset 6 into destination object 'b6'
of size 6" "note" }
};

void max_B6_B4 (int i, struct B4_B6 *pb4_b6)
{
char *p = pb4_b6->b6 + i;
char *q = pb4_b6->b4 + i;
  char *d = MAX (p, q);

  d[3] = 0;
  d[4] = 0;
  d[5] = 0;
  d[6] = 0;         // { dg-warning "writing 1 byte into a region of size 0 " }

After vectorization, no warning message output, option: -O2 -Wno-array-bounds

Expected output warning message

test.c: In function ‘max_B6_B4’:
test.c:17:8: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
   17 |   d[6] = 0;         // { dg-warning "writing 1 byte into a region of
size 0 "" { xfail vect_int }" }
      |   ~~~~~^~~
test.c:5:8: note: at offset 6 into destination object ‘b6’ of size 6
    5 |   char b6[6];       // { dg-message "at offset
\[^a-zA-Z\n\r\]*6\[^a-zA-Z0-9\]* into destination object 'b6' of size 6" "note"
{ xfail vect_int } }
      |        ^~

Reply via email to