[NDS32] Add intrinsic functions for TLB operation and data prefech.
[official-gcc.git] / gcc / testsuite / gcc.dg / attr-alloc_size-9.c
blob0c50b0ab63cd3469196a29147cd2e0af6a64652a
1 /* PR c/78284 - warn on malloc with very large arguments
2 Test verifying that the built-in allocation functions are declared
3 with attribute malloc. This means that the pointer they return
4 can be assumed not to alias any other valid pointer. */
5 /* { dg-do compile } */
6 /* { dg-require-effective-target alloca } */
7 /* { dg-options "-O2 -fdump-tree-optimized" } */
9 void sink (void*);
11 extern int x;
13 #define TEST(call) \
14 do { \
15 p = call; \
16 x = 123; \
17 *(int*)p = 456; \
18 (x == 123) ? (void)0 : __builtin_abort (); \
19 sink (p); \
20 } while (0)
22 void test (void *p, unsigned n)
24 TEST (__builtin_aligned_alloc (8, n));
25 TEST (__builtin_alloca (n));
26 TEST (__builtin_calloc (4, n));
27 TEST (__builtin_malloc (n));
28 TEST (__builtin_realloc (p, n + 1));
31 /* { dg-final { scan-tree-dump-not "abort" "optimized" } } */