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: [C++ patch] Set attributes for C++ runtime library calls


On 08/22/2013 12:45 PM, Gabriel Dos Reis wrote:
If the user-supplied operator new returns &a, then it must
also ensure that 'a' is not used anywhere else -- e.g. I you can't
do lvalue-to-value conversion on 'a' to see what is written there.
Because its storage has been reused.  That is, aliasing is framed
in terms of object lifetime and uniqueness of ownership.

Do you have a reference for this? The wording in 3.8 seems to only restrict how a pointer is used when there is no object in the storage, it doesn't say anything about using a pointer to access a different object at the same location.

This issue seems to be core 1338:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1338

which has priority 2, so it's not likely to get resolved any time soon. I'll ask to reconsider the priority at the next meeting.

We probably can go with -fno-user-overwritten-new or something similar?

I'd name it something like -fno-aliased-global-new, which would add the malloc attribute to the built-in declarations.

Jason


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