libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / Walloc-size-larger-than-5.c
blob774c4cf271b90f600fa92a7543e48124c369eb43
1 /* PR middle-end/82063 - issues with arguments enabled by -Wall
2 { dg-do compile }
3 { dg-require-effective-target size32plus }
4 { dg-options "-O -Walloc-size-larger-than=1MB -ftrack-macro-expansion=0" } */
6 void sink (void*);
8 #define T(x) sink (x)
10 void f (void)
12 __SIZE_TYPE__ n = 0;
13 T (__builtin_malloc (n));
15 n = 1000 * 1000; /* 1 megabyte (MB) */
16 T (__builtin_malloc (n));
18 n += 1;
19 T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000001. exceeds maximum object size 1000000" } */
21 n = __PTRDIFF_MAX__;
22 T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size 1000000" } */
24 n = __SIZE_MAX__;
25 T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size 1000000" } */