OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
* decl.c (start_preparsed_function): Set
[pf3gnuchains/gcc-fork.git]
/
gcc
/
testsuite
/
g++.dg
/
opt
/
alias1.C
1
// Test that type punning using an anonymous union works with strict aliasing.
2
// { dg-do run }
3
// { dg-options "-O2 -fstrict-aliasing" }
4
5
extern "C" void abort ();
6
7
void f (long i)
8
{
9
union
10
{
11
long ui;
12
float uf[20];
13
};
14
15
ui = i;
16
if (uf[0] != 42.0)
17
abort ();
18
}
19
20
int main ()
21
{
22
union U { long i; float f[20]; } u;
23
u.f[0] = 42.0;
24
f (u.i);
25
}