]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tree-ssa/calloc-5.c
1 /* PR tree-optimization/83821 - local aggregate initialization defeats
3 Verify that with DSE disabled, a memset() call to zero out a subregion
4 of memory allocated by calloc() is not eliminated after a non-zero byte
5 is written into it using memset() in between the two calls.
7 { dg-options "-O2 -fno-tree-dse -fdump-tree-optimized" } */
9 char* keep_memset_calls (void)
11 char *p
= __builtin_calloc (12, 1);
13 __builtin_memset (p
+ 5, 1, 2); /* dead store (not eliminated) */
15 __builtin_memset (p
, 0, 12); /* must not be eliminated */
20 /* { dg-final { scan-tree-dump-not "malloc" "optimized" } }
21 { dg-final { scan-tree-dump-times "_calloc \\\(" 1 "optimized" } }
22 { dg-final { scan-tree-dump-times "_memset \\\(" 2 "optimized" } } */