On 06/23/2015 09:44 PM, Pat Haugen wrote:
On 06/18/2015 06:10 AM, Richard Biener wrote:
You are right that we should call ::new just for classes that have 
m_ignore_type_size == false.
>I've come up with following patch, that I tested slightly:
>
>diff --git a/gcc/alloc-pool.h b/gcc/alloc-pool.h
>index 1785df5..7da5f7a 100644
>--- a/gcc/alloc-pool.h
>+++ b/gcc/alloc-pool.h
>@@ -412,8 +412,16 @@ pool_allocator<T>::allocate ()
>  #endif
>    VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (header, size));
>
>+  T *ptr = (T *)header;
>+
>    /* Call default constructor.  */
>-  return (T *)(header);
>+  if (!m_ignore_type_size)
>+    {
>+      memset (header + sizeof (T), 0, m_extra_size);
>+      return ::new (ptr) T;
>+    }
>+  else
>+    return ptr;
>  }
>
>  /* Puts PTR back on POOL's free list.  */
>
>Would it be suitable?
Suitable with the memset removed, yes.
What's the status of this patch? I have a couple spec regression testers that 
have been unable to build GCC due to this issue, specifically the sched-deps.c 
change. The above patch (with memset removed) does result in a successful build.

Thanks,
Pat


Hello.

I've finishing a new patch that will do the job in more suitable way.

Martin

Reply via email to