PR testsuite/52641
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-fre-7.c
bloba758efe5dda540e3e759f31ba2fca87545e062aa
1 /* { dg-do compile } */
2 /* { dg-options "-O -fno-tree-sra -fdump-tree-fre1-details -fdump-tree-optimized" } */
3 #if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
4 typedef int intflt;
5 #elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
6 typedef long intflt;
7 #else
8 #error Add target support here for type that will union float size
9 #endif
11 struct X {
12 int i;
13 union {
14 intflt j;
15 intflt k;
16 float f;
17 } u;
20 intflt foo(intflt j)
22 struct X a;
24 a.u.j = j;
25 a.u.f = a.u.f;
26 a.u.f = a.u.f;
27 a.u.j = a.u.j;
28 a.u.f = a.u.f;
29 return a.u.k;
32 /* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre1" } } */
33 /* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre1" } } */
34 /* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre1" } } */
35 /* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre1" } } */
36 /* { dg-final { scan-tree-dump "return j" "optimized" } } */
37 /* { dg-final { cleanup-tree-dump "fre1" } } */
38 /* { dg-final { cleanup-tree-dump "optimized" } } */