diff options
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.8.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch | 78 |
2 files changed, 79 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.8.inc b/meta/recipes-devtools/gcc/gcc-4.8.inc index 42355f2102..9d92edabc3 100644 --- a/meta/recipes-devtools/gcc/gcc-4.8.inc +++ b/meta/recipes-devtools/gcc/gcc-4.8.inc | |||
@@ -71,6 +71,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ | |||
71 | file://0039-gcc-4.8-PR57717.patch \ | 71 | file://0039-gcc-4.8-PR57717.patch \ |
72 | file://0040-fix-g++-sysroot.patch \ | 72 | file://0040-fix-g++-sysroot.patch \ |
73 | file://0041-libtool-avoid-libdir.patch \ | 73 | file://0041-libtool-avoid-libdir.patch \ |
74 | file://0042-pr57748.patch \ | ||
74 | " | 75 | " |
75 | SRC_URI[md5sum] = "3b2386c114cd74185aa3754b58a79304" | 76 | SRC_URI[md5sum] = "3b2386c114cd74185aa3754b58a79304" |
76 | SRC_URI[sha256sum] = "545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813" | 77 | SRC_URI[sha256sum] = "545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813" |
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 0000000000..5356f722d9 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.8/0042-pr57748.patch | |||
@@ -0,0 +1,78 @@ | |||
1 | Upstream-Status: Backport | ||
2 | Signed-off-by: Khem Raj | ||
3 | |||
4 | 2013-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 | |||
10 | testsuite/ | ||
11 | * gcc.dg/torture/pr57748.c: New test. | ||
12 | |||
13 | |||
14 | Index: 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 | ||
29 | Index: 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 | +} | ||