On Mon, 26 Jun 2006, Andrew Pinski wrote:

> 
> On Jun 26, 2006, at 2:07 AM, Richard Guenther wrote:
> 
> >So even
> >(len + sizeof (struct tree_string)) & ~__alignof__(struct tree_string)
> >might magically work in every case.
> 
> Of course using __alignof__ is wrong in GCC sources since that would mean
> you have to use GCC to bootstrap with which is not documented.
> 
> But this does not explain PPC-Darwin's problem as PPC is not a
> STRICT_ALIGNMENT target.
> So either we are allocating too little or someone is going past an array
> bounds somewhere.

I'll currently investigate "fixing" build_string, which interestingly
fails and may hint at a problem elsewhere.  Of course alignof is wrong, 
but one can use

  /* Make sure to request aligned storage and do not waste bytes
     provided by padding of struct tree_string.  */
  length = ((len + sizeof (struct tree_string))
            & ~(sizeof (struct tree_string)
                - offsetof (struct tree_string, str) - 1));

instead (not pretty, but works).

Richard.

--
Richard Guenther <[EMAIL PROTECTED]>
Novell / SUSE Labs

Reply via email to