This is the mail archive of the 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]

Re: [PR19351, C++] Fix heap overflow in operator new[]

On Sat, Feb 6, 2010 at 10:31 AM, Florian Weimer <> wrote:
> * Eric Botcazou:
>>> The advantage of this approach is full ABI compatibility (in both
>>> directions). The downside is slightly worse code (but it's still
>>> branch-free; support for saturating arithmetic would probably improve things
>>> further).
>> What do you mean by "branch-free" exactly? ?The code generates 2 COND_EXPRs.
> Oops, sorry. ?"Branch-free on i386 and amd64, for the common case of
> non-VLAs". ?The outer COND_EXPR and the division are removed by fold
> because the object size is known at compile time.
> (The VLA case is a GCC extension, likely totally unused in this
> particular context, so I don't mind the really bad code which is
> generated for that.)

I'd rather have you using something that expands to the saturating
SS_PLUS and SS_MULT rtx codes - which means using fixed-point
types and adjusting the middle-end to expand saturating operations
with generic code sequences if the target does not provide them
(with SSE they are for example available on x86_64).


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