summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0106-PR-c-48517.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0106-PR-c-48517.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0106-PR-c-48517.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0106-PR-c-48517.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0106-PR-c-48517.patch
new file mode 100644
index 0000000000..8fba6af3b8
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0106-PR-c-48517.patch
@@ -0,0 +1,51 @@
1From b58a503c5dbde32cbb9bd48ea16ff868d2023cf9 Mon Sep 17 00:00:00 2001
2From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Tue, 12 Apr 2011 06:53:13 +0000
4Subject: [PATCH 106/200] PR c/48517
5 * c-typeck.c (store_init_value): Set TREE_TYPE (decl) to
6 qualified type.
7
8 * gcc.c-torture/compile/pr48517.c: New test.
9
10
11git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172300 138bc75d-0d04-0410-961f-82ee72b054a4
12
13index a22bb73..fca369c 100644
14--- a/gcc/c-typeck.c
15+++ b/gcc/c-typeck.c
16@@ -5773,11 +5773,13 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype)
17 /* For int foo[] = (int [3]){1}; we need to set array size
18 now since later on array initializer will be just the
19 brace enclosed list of the compound literal. */
20+ tree etype = strip_array_types (TREE_TYPE (decl));
21 type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type));
22- TREE_TYPE (decl) = type;
23 TYPE_DOMAIN (type) = TYPE_DOMAIN (TREE_TYPE (cldecl));
24 layout_type (type);
25 layout_decl (cldecl, 0);
26+ TREE_TYPE (decl)
27+ = c_build_qualified_type (type, TYPE_QUALS (etype));
28 }
29 }
30 }
31new file mode 100644
32index 0000000..30b3ecb
33--- /dev/null
34+++ b/gcc/testsuite/gcc.c-torture/compile/pr48517.c
35@@ -0,0 +1,13 @@
36+/* PR c/48517 */
37+/* { dg-do compile } */
38+/* { dg-options "" } */
39+
40+void bar (const unsigned short *);
41+
42+void
43+foo (void)
44+{
45+ static const unsigned short array[] = (const unsigned short []) { 0x0D2B };
46+ const unsigned short *ptr = array;
47+ bar (ptr);
48+}
49--
501.7.0.4
51