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

Florian Weimer fw@deneb.enyo.de
Sat Feb 6 09:32:00 GMT 2010


* 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.)



More information about the Gcc-patches mailing list