PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / pr78973-2.c
blobcc3cfc5b157da45044fdb9cfa0e17e0ff9063496
1 /* PR c/78973 - warning: ‘memcpy’: specified size exceeds maximum object
2 size [-Wstringop-overflow=]
4 This is a companion test for the bug above that verifies that the correct
5 range of the int variable is detected.
7 { dg-do compile }
8 { dg-require-effective-target int32plus }
9 { dg-options "-O2 -Walloc-size-larger-than=4" } */
11 void *p;
13 void f (int n)
15 if (n <= 4)
16 p = __builtin_malloc (n);
17 /* { dg-warning "argument 1 range \\\[\[0-9\]+, \[0-9\]+\\\] exceeds maximum object size 4" "ilp32" { xfail { ! lp64 } } .-1 } */
20 void g (unsigned n)
22 if (n < 5)
23 n = 5;
24 f (n);