gcc/testsuite/gcc.dg/tree-ssa/pr86061.c
raw| 1 | /* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre" } */ |
| 2 | |
| 3 | |
| 4 | struct S { int i; char n[128]; int j; }; |
| 5 | |
| 6 | void f (char*); |
| 7 | |
| 8 | void g (struct S *p) |
| 9 | { |
| 10 | char a[sizeof p->n + 1]; |
| 11 | |
| 12 | __builtin_memset (a, 0, sizeof a); // dead store, can be eliminated |
| 13 | |
| 14 | __builtin_strncpy (a, p->n, sizeof a - 1); |
| 15 | a[sizeof a - 1] = '\0'; |
| 16 | |
| 17 | f (a); |
| 18 | } |
| 19 | |
| 20 | /* { dg-final { scan-tree-dump-times "Deleted dead call" 1 "dse1" } } */ |