aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-08-12 10:07:57 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-08-12 10:07:57 +0200
commit2d7231a35cc789bc7e42835e74a3f3131bb57518 (patch)
tree27fa7e139702c2af55d394f06a68e220c7210e1b /gcc/gimplify.c
parentbe349cac63fd9133c01354441a25ac1558e5c9c1 (diff)
downloadgcc-2d7231a35cc789bc7e42835e74a3f3131bb57518.zip
gcc-2d7231a35cc789bc7e42835e74a3f3131bb57518.tar.gz
gcc-2d7231a35cc789bc7e42835e74a3f3131bb57518.tar.bz2
re PR c++/36688 (Incorrect struct assignments with nested const initializers)
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
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f22111d..753aa59 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3913,7 +3913,7 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p,
/* 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)
{