]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / Walloc-size-larger-than-5.c
CommitLineData
d258f4aa
MS
1/* PR middle-end/82063 - issues with arguments enabled by -Wall
2 { dg-do compile }
f4a14e09 3 { dg-require-effective-target size32plus }
d258f4aa
MS
4 { dg-options "-O -Walloc-size-larger-than=1MB -ftrack-macro-expansion=0" } */
5
6void sink (void*);
7
8#define T(x) sink (x)
9
10void f (void)
11{
12 __SIZE_TYPE__ n = 0;
13 T (__builtin_malloc (n));
14
15 n = 1000 * 1000; /* 1 megabyte (MB) */
16 T (__builtin_malloc (n));
17
18 n += 1;
19 T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000001. exceeds maximum object size 1000000" } */
20
21 n = __PTRDIFF_MAX__;
22 T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size 1000000" } */
23
24 n = __SIZE_MAX__;
25 T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size 1000000" } */
26}