summaryrefslogtreecommitdiff
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 000000000..8fba6af3b
--- /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 @@
+From b58a503c5dbde32cbb9bd48ea16ff868d2023cf9 Mon Sep 17 00:00:00 2001
+From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 12 Apr 2011 06:53:13 +0000
+Subject: [PATCH 106/200] PR c/48517
+ * c-typeck.c (store_init_value): Set TREE_TYPE (decl) to
+ qualified type.
+
+ * gcc.c-torture/compile/pr48517.c: New test.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172300 138bc75d-0d04-0410-961f-82ee72b054a4
+
+index a22bb73..fca369c 100644
+--- a/gcc/c-typeck.c
++++ b/gcc/c-typeck.c
+@@ -5773,11 +5773,13 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype)
+ /* For int foo[] = (int [3]){1}; we need to set array size
+ now since later on array initializer will be just the
+ brace enclosed list of the compound literal. */
++ tree etype = strip_array_types (TREE_TYPE (decl));
+ type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type));
+- TREE_TYPE (decl) = type;
+ TYPE_DOMAIN (type) = TYPE_DOMAIN (TREE_TYPE (cldecl));
+ layout_type (type);
+ layout_decl (cldecl, 0);
++ TREE_TYPE (decl)
++ = c_build_qualified_type (type, TYPE_QUALS (etype));
+ }
+ }
+ }
+new file mode 100644
+index 0000000..30b3ecb
+--- /dev/null
++++ b/gcc/testsuite/gcc.c-torture/compile/pr48517.c
+@@ -0,0 +1,13 @@
++/* PR c/48517 */
++/* { dg-do compile } */
++/* { dg-options "" } */
++
++void bar (const unsigned short *);
++
++void
++foo (void)
++{
++ static const unsigned short array[] = (const unsigned short []) { 0x0D2B };
++ const unsigned short *ptr = array;
++ bar (ptr);
++}
+--
+1.7.0.4
+