[Bug tree-optimization/26388] Variable sized storage allocation should be promoted to stack allocation

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 17 21:53:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26388

--- Comment #18 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #17)
> The quoted text allows an implementation to to merge calls made by two or
> more new expressions to the underlying allocation function (operator new). 
> It can call it just once but it's can't avoid calling it altogether.

Yes it can: "allowed to omit a call", "the storage is instead provided by the
implementation".

> There is no such a permission for calls to the allocation function itself.

Ahhh, now I remember thinking that they had messed up by specifying it only for
new expressions, which forced them to introduce a builtin in llvm to
differentiate calls to operator new coming from new expressions and direct ones
(for instance by the allocator)... Though of course that appears to have been a
voluntary change between N3537 and N3664, I found on the Bristol wiki this
single remark "Better to have the merging apply only to new-expressions and not
to explicit calls to operator new()" without justification. Maybe I should ask
CWG what the reason was.


More information about the Gcc-bugs mailing list