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: Mark va_start as nothrow


> On Fri, Apr 17, 2009 at 5:43 AM, Mark Mitchell <mark@codesourcery.com> wrote:
> > Jan Hubicka wrote:
> >
> >> I think it is safe to mark them nothorw. ?With -fnon-call-exceptions
> >> they can theoretically be given bad pointer,
> >
> > Good point!
> >
> >> but other similar
> >> functions that can ICE are already marked NOTHROW (such as sprintf).
> >> Or if this is not true, I can probably add ATTR_NONTRHOW_FOR_NCE_LIST
> >
> > I think we should do that. ?Otherwise, -fnon-call-exceptions is broken.
> > ?It sounds like we already have a problem, but we should try to avoid
> > making it worse.
> 
> I think for -fnon-call-exceptions we have to disregard possible
> nothrow attributes
> on non-local binding functions anyway.  At least the nothrow attribute
> documentation
> does not mention possible interactions with -fnon-call-exceptions.

Thinking about this more, the non-call-exceptions and use of any of C++
standard library is iffy.  It is not built with the flag and thus any
kind of ICE will not be properly handled anyway.  One can not resonably
expect sprintf to produce sane non-call-exception (on the other hand,
one can probably expect hook called via GNU printf formatting exception
to throw exception that is properly tunelled through sprintf?).

Since -fnon-call-exceptions is really Java thingy, where C++ runtime is
irrelevant, I am not sure how much better we need to be on builtins.
If it seems, we can hope for some sanity here, I will add the NCE_LISTs.

Honza
> 
> Thus for our builtins we have to distinguish the cases where we have to drop
> nothrow in the face of -fnon-call-exceptions and where not.  Of course we
> rely on implementation details here as nearly all functions could eventually
> end up allocating memory and thus throw.
> 
> Richard.


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