[Bug c++/36688] [4.3/4.4 Regression] Incorrect struct assignments with nested const initializers
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Aug 11 20:51:00 GMT 2008
------- Comment #2 from jakub at gcc dot gnu dot org 2008-08-11 20:50 -------
I think in gimplify_modify_expr_rhs
case VAR_DECL:
/* 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_THIS_VOLATILE (*from_p)
&& TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR)
we should be checking TREE_READONLY (*from_p) rather than TYPE_READONLY
(TREE_TYPE (*from_p)), as when the type is read-only, but the VAR_DECL is not,
the initializer in DECL_INITIAL might be still incomplete and needing runtime
initialization.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2008-08-11 01:38:50 |2008-08-11 20:50:26
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36688
More information about the Gcc-bugs
mailing list