Merge from trunk @ 138209
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr19637.C
blobcf70e40412350c93b3e5cdfbc7ed8cdd4b38fa5e
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-dom1" } */
4 #include <new>
6 struct Foo {
7   Foo() { i[0] = 1; }
8   int i[2];
9 };
11 int foo_char(void)
13   int i[2];
14   new (reinterpret_cast<char *>(i)) Foo();
15   return reinterpret_cast<Foo *>(i)->i[0];
18 int foo_void(void)
20   int i[2];
21   new (reinterpret_cast<void *>(i)) Foo();
22   return reinterpret_cast<Foo *>(i)->i[0];
25 int foo_void_offset(void)
27   int i[2];
28   new (reinterpret_cast<void *>(&i[0])) Foo();
29   return reinterpret_cast<Foo *>(&i[0])->i[0];
32 /* Regarding the xfail, see PR36143.  */
33 /* { dg-final { scan-tree-dump-times "return 1;" 3 "dom1" { xfail *-*-* } } } */
34 /* { dg-final { cleanup-tree-dump "dom1" } } */