This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/29286] [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should
- 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 May 2007 12:06:10 -0000
- Subject: [Bug libstdc++/29286] [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should
- References: <bug-29286-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #71 from rguenth at gcc dot gnu dot org 2007-05-16 13:05 -------
But it doesn't fix the POOMA miscompilations if I change its Pool allocator to
use placement new instead of this
// Release a block to the pool.
inline void free(void *b)
{
// Record a free.
outstandingAllocs_m -= 1;
// Cast the pointer to the right type.
Link *p = (Link*)b;
// Make it point to the current head of the free list.
p->next_m = head_m;
// Make the next one the new head of the list.
// We can't do head_m = p->next_m since p will soon be treated
// as something other than a Link. By doing this assignment
// with memcpy, we ensure that p->next_m will be read before
// it is clobbered.
memcpy(&p->next_m, &head_m, sizeof(head_m));
// Make it the head of the free list.
head_m = p;
}
memcpy hack. I'll try to investigate...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286