view gcc/testsuite/gcc.dg/pr89350.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* PR tree-optimization/89350 - Wrong -Wstringop-overflow warning
   on a variable offset from the end of an array
   { dg-do compile }
   { dg-options "-O2 -Wall" } */

char buf[128];
char *src = "HCSparta";

int main(int argc, char **argv)
{
    char *dst = buf + sizeof(buf);

    if (argc)
    {
      dst -= argc;
      __builtin_memcpy(dst, src, argc + 0);   /* { dg-bogus "\\\[-Warray-bounds|-Wstringop-overflow" } */
    }
}