gcc/testsuite/g++.dg/tree-ssa/ssa-dse-3.C
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-std=c++14 -O3 -fdump-tree-dse1-details" } */ |
| 3 | |
| 4 | #include <new> |
| 5 | #include <cstdint> |
| 6 | |
| 7 | struct A |
| 8 | { |
| 9 | std::uint16_t a, b; |
| 10 | }; |
| 11 | |
| 12 | A* f(char* b) __attribute__((noinline)); |
| 13 | |
| 14 | A* f(char* b) { |
| 15 | auto a = new(b) A{}; |
| 16 | a->a = 1; |
| 17 | a->b = 2; |
| 18 | return a; |
| 19 | } |
| 20 | |
| 21 | int main() { |
| 22 | char b[sizeof(A)] alignas(A); |
| 23 | f(b); |
| 24 | } |
| 25 | |
| 26 | |
| 27 | /* { dg-final { scan-tree-dump "Deleted dead store: " "dse1" } } */ |
| 28 |