repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
strub: enable conditional support
[official-gcc.git]
/
gcc
/
testsuite
/
g++.dg
/
torture
/
pr78189.C
blob
9b65d2b5a6366af5c2674f488df8bd737364b6c0
1
/* { dg-do run } */
2
/* { dg-additional-options "-ftree-slp-vectorize -fno-vect-cost-model" } */
3
4
#include <cstddef>
5
6
struct A
7
{
8
void * a;
9
void * b;
10
};
11
12
struct alignas(16) B
13
{
14
void * pad;
15
void * misaligned;
16
void * pad2;
17
18
A a;
19
20
void Null();
21
};
22
23
void B::Null()
24
{
25
a.a = nullptr;
26
a.b = nullptr;
27
}
28
29
void __attribute__((noinline,noclone))
30
NullB(void * misalignedPtr)
31
{
32
B* b = reinterpret_cast<B*>(reinterpret_cast<char *>(misalignedPtr) - offsetof(B, misaligned));
33
b->Null();
34
}
35
36
int main()
37
{
38
B b;
39
NullB(&b.misaligned);
40
return 0;
41
}