[Bug c++/37847] Invalid tree sharing with CHANGE_DYNAMIC_TYPE_EXPR

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Oct 16 09:25:00 GMT 2008



------- 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



More information about the Gcc-bugs mailing list