summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch b/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch
new file mode 100644
index 0000000..5356f72
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch
@@ -0,0 +1,78 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj
3
42013-08-01 Martin Jambor <mjambor@suse.cz>
5
6 PR middle-end/57748
7 * stor-layout.c (compute_record_mode): Treat zero-sized array fields
8 like incomplete types.
9
10testsuite/
11 * gcc.dg/torture/pr57748.c: New test.
12
13
14Index: gcc-4.8.1/gcc/stor-layout.c
15===================================================================
16--- gcc-4.8.1.orig/gcc/stor-layout.c 2013-04-28 10:29:18.000000000 -0700
17+++ gcc-4.8.1/gcc/stor-layout.c 2013-08-01 15:02:08.018006125 -0700
18@@ -1618,7 +1618,9 @@
19 && integer_zerop (TYPE_SIZE (TREE_TYPE (field)))))
20 || ! host_integerp (bit_position (field), 1)
21 || DECL_SIZE (field) == 0
22- || ! host_integerp (DECL_SIZE (field), 1))
23+ || ! host_integerp (DECL_SIZE (field), 1)
24+ || (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
25+ && tree_low_cst (DECL_SIZE (field), 1) == 0))
26 return;
27
28 /* If this field is the whole struct, remember its mode so
29Index: gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c
30===================================================================
31--- /dev/null 1970-01-01 00:00:00.000000000 +0000
32+++ gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c 2013-08-01 15:02:08.062006126 -0700
33@@ -0,0 +1,45 @@
34+/* PR middle-end/57748 */
35+/* { dg-do run } */
36+
37+#include <stdlib.h>
38+
39+extern void abort (void);
40+
41+typedef long long V
42+ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
43+
44+typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
45+
46+struct __attribute__((packed)) T { char c; P s; };
47+
48+void __attribute__((noinline, noclone))
49+check (struct T *t)
50+{
51+ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
52+ abort ();
53+}
54+
55+int __attribute__((noinline, noclone))
56+get_i (void)
57+{
58+ return 0;
59+}
60+
61+void __attribute__((noinline, noclone))
62+foo (P *p)
63+{
64+ V a = { 3, 4 };
65+ int i = get_i();
66+ p->b[i] = a;
67+}
68+
69+int
70+main ()
71+{
72+ struct T *t = (struct T *) malloc (128);
73+
74+ foo (&t->s);
75+ check (t);
76+
77+ return 0;
78+}