2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr78189.C
blob9b65d2b5a6366af5c2674f488df8bd737364b6c0
1 /* { dg-do run } */
2 /* { dg-additional-options "-ftree-slp-vectorize -fno-vect-cost-model" } */
4 #include <cstddef>
6 struct A
8   void * a;
9   void * b;
12 struct alignas(16) B
14   void * pad;
15   void * misaligned;
16   void * pad2;
18   A a;
20   void Null();
23 void B::Null()
25   a.a = nullptr;
26   a.b = nullptr;
29 void __attribute__((noinline,noclone))
30 NullB(void * misalignedPtr)
32   B* b = reinterpret_cast<B*>(reinterpret_cast<char *>(misalignedPtr) - offsetof(B, misaligned));
33   b->Null();
36 int main()
38   B b;
39   NullB(&b.misaligned);
40   return 0;