On 05/06/2013 08:46 AM, Florian Weimer wrote:
On 05/06/2013 02:39 PM, Jason Merrill wrote:
On 05/06/2013 05:46 AM, Florian Weimer wrote:
Nice, this is simpler than expected.  However, it makes the call sites
even more bloated.

Hmm, perhaps the checking should be wrapped in an inline function, so
that the inliner can decide whether or not to expand it at the call
site...

Or we could call __cxa_vec_new[23] and rely on the check there

True. The problem with using those is the indirect calls to the (possibly inline) constructors, though it might be worth doing conditionally. Would you be interested in working on that change?

(in most
cases—for new T[a][b], we'd still need a separate overflow check).

But new T[a][b] is ill-formed, so we don't need to handle that case.

This patch also adds the type to libsupc++, and several exports to
libstdc++.

There's also overflow checking inside __cxa_vec_new[23].  At this point,
we don't know if the caller was compiled in C++11 mode.  But for C++03
code, throwing a subclass of std::bad_alloc probably won't hurt.

And we never use __cxa_vec_new* anyway, they're only there because the
ABI requires them.

EDG-derived compilers will call it, so we should fix it as well.

Right.

Jason

Reply via email to