This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37847] Invalid tree sharing with CHANGE_DYNAMIC_TYPE_EXPR
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Oct 2008 09:24:16 -0000
- Subject: [Bug c++/37847] Invalid tree sharing with CHANGE_DYNAMIC_TYPE_EXPR
- References: <bug-37847-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from rguenth at gcc dot gnu dot org 2008-10-16 09:24 -------
A solution would be to wrap the placement in a SAVE_EXPR in all callers of
avoid_placement_new_aliasing, thus the following seems to fix it:
Index: init.c
===================================================================
*** init.c (revision 141164)
--- init.c (working copy)
*************** build_new_1 (tree placement, tree type,
*** 2041,2046 ****
--- 2041,2047 ----
|| VOID_TYPE_P (TREE_TYPE (TREE_TYPE (placement_arg))))
{
placement_expr = get_target_expr (TREE_VALUE (placement));
+ placement_expr = save_expr (placement_expr);
CALL_EXPR_ARG (alloc_call, 1)
= convert (TREE_TYPE (placement_arg), placement_expr);
}
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-10-16 09:24:15
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37847