blob: 7003cf83767d2b2765f5a6b5c2fa8846e3175453 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
2010-08-05 Jie Zhang <jie@codesourcery.com>
Issue #7257
Backport from mainline:
gcc/
2010-08-05 Jie Zhang <jie@codesourcery.com>
PR tree-optimization/45144
* tree-sra.c (type_consists_of_records_p): Return false
if the record contains bit-field.
gcc/testsuite/
2010-08-05 Jie Zhang <jie@codesourcery.com>
PR tree-optimization/45144
* gcc.dg/tree-ssa/pr45144.c: New test.
2010-08-04 Mark Mitchell <mark@codesourcery.com>
Backport from mainline:
=== added file 'gcc/testsuite/gcc.dg/tree-ssa/pr45144.c'
--- old/gcc/testsuite/gcc.dg/tree-ssa/pr45144.c 1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/tree-ssa/pr45144.c 2010-08-20 16:04:44 +0000
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+void baz (unsigned);
+
+extern unsigned buf[];
+
+struct A
+{
+ unsigned a1:10;
+ unsigned a2:3;
+ unsigned:19;
+};
+
+union TMP
+{
+ struct A a;
+ unsigned int b;
+};
+
+static unsigned
+foo (struct A *p)
+{
+ union TMP t;
+ struct A x;
+
+ x = *p;
+ t.a = x;
+ return t.b;
+}
+
+void
+bar (unsigned orig, unsigned *new)
+{
+ struct A a;
+ union TMP s;
+
+ s.b = orig;
+ a = s.a;
+ if (a.a1)
+ baz (a.a2);
+ *new = foo (&a);
+}
+
+/* { dg-final { scan-tree-dump "x = a;" "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
=== modified file 'gcc/tree-sra.c'
--- old/gcc/tree-sra.c 2010-08-10 13:31:21 +0000
+++ new/gcc/tree-sra.c 2010-08-20 16:04:44 +0000
@@ -805,7 +805,7 @@
/* Return true iff TYPE is a RECORD_TYPE with fields that are either of gimple
register types or (recursively) records with only these two kinds of fields.
It also returns false if any of these records has a zero-size field as its
- last field. */
+ last field or has a bit-field. */
static bool
type_consists_of_records_p (tree type)
@@ -821,6 +821,9 @@
{
tree ft = TREE_TYPE (fld);
+ if (DECL_BIT_FIELD (fld))
+ return false;
+
if (!is_gimple_reg_type (ft)
&& !type_consists_of_records_p (ft))
return false;
|