This is the mail archive of the gcc-patches@gcc.gnu.org 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[]


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


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