This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Marking C++ new operator as malloc?
On Sat, Sep 08, 2007 at 12:57:13AM -0500, Gabriel Dos Reis wrote:
> Joe Buck <Joe.Buck@synopsys.COM> writes:
>
> | On Sep 7, 2007, at 1:53 PM, Martin Jambor wrote:
> | > [ giving operator new the malloc property ]
> |
> | On Fri, Sep 07, 2007 at 06:30:33PM -0700, Chris Lattner wrote:
> | > It is unclear whether this is safe. Nothing in the standard AFAIK
> | > requires the operator new be implemented in terms of malloc, and
> | > users are allowed to override it.
> |
> | The malloc property doesn't mean that operator new is defined in terms
> | of malloc. It refers to the aliasing properties of the returned
> | values; specifically, the compiler can assume that two separate calls
> | return values that don't alias each other.
>
> I seem to remember we had had this discussion before -- in connection
> with optimizations related to 'malloc' attribute -- and decided not to
> apply the attribute because it was not clear whether it was permitted
> by the standard. I don't seem to get my hands on reference to the
> thread right now.
>
There is a related bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32748
H.J.