PR c++/36688
* gimplify.c (gimplify_modify_expr_rhs): Test TREE_READONLY
on the VAR_DECL instead of TYPE_READONLY on its type.
* g++.dg/init/const6.C: New test.
From-SVN: r139004
+2008-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/36688
+ * gimplify.c (gimplify_modify_expr_rhs): Test TREE_READONLY
+ on the VAR_DECL instead of TYPE_READONLY on its type.
+
2008-08-12 Ira Rosen <irar@il.ibm.com>
* tree-vectorizer.c: Depend on langhooks.h.
/* If we're assigning from a constant constructor, move the
constructor expression to the RHS of the MODIFY_EXPR. */
if (DECL_INITIAL (*from_p)
- && TYPE_READONLY (TREE_TYPE (*from_p))
+ && TREE_READONLY (*from_p)
&& !TREE_THIS_VOLATILE (*from_p)
&& TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR)
{
+2008-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/36688
+ * g++.dg/init/const6.C: New test.
+
2008-08-12 Ira Rosen <irar@il.ibm.com>
* gcc.dg/vect/vect-multitypes-12.c: New.
--- /dev/null
+// PR c++/36688
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct S
+{
+ long long a;
+ long long b;
+ long long c;
+};
+
+struct T
+{
+ S g;
+ long long h[12];
+};
+
+static const S s = { 1, 2, 3 };
+static const T t = { s, 0 };
+
+int
+main ()
+{
+ T x = t;
+ if (__builtin_memcmp (&x, &t, sizeof (T)))
+ __builtin_abort ();
+}