This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/51231] [4.5/4.6/4.7 Regression] g++ remove placement new with -O1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51231

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-07 11:45:31 UTC ---
Confirmed.  The store of 0xdeadbeef is gone:

void create(allocator_type&, boost::interprocess::allocator<int,
boost::interprocess::segment_manager<char,
boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>,
boost::interprocess::iset_index> >::value_type&, int) (struct allocator_type &
allocator, value_type & at, int value)
{
  value_type * myp;
  const ptrdiff_t D.99202;
  sizetype D.99201;
  struct pointer D.83867;

<bb 2>:
  # USE = nonlocal { D.83867 }
  # CLB = nonlocal { D.83867 }
  D.83867 = boost::interprocess::allocator<int,
boost::interprocess::segment_manager<char,
boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>,
boost::interprocess::iset_index> >::address (allocator_1(D), at_2(D)); [return
slot optimization]
  D.99202_7 = D.83867.internal.m_offset;
  if (D.99202_7 != 1)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  D.99201_8 = (sizetype) D.99202_7;
  # PT = { D.83867 }
  myp_9 = &D.83867 + D.99201_8;

<bb 4>:
  # PT = null { D.83867 }

  # myp_10 = PHI <0B(2), myp_9(3)>
  if (myp_10 != 0B)
    goto <bb 5>;
  else
    goto <bb 6>;

<bb 5>:
  value_11 = value_14(D);
  *myp_10 = value_11;

<bb 6>:
  D.83867 ={v} {CLOBBER};
  return;

}

in ealias.  Note that Boost invokes undefined behavior here as it
computes &D.83867 + D.83867.internal.m_offset which supposedly
points to an object that is not D.83867 obviously, as that is
automatic in function create() and the store would be dead anyway.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]