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: assert infrastructure for runtime


Nathan Sidwell wrote:
Mark Mitchell wrote:

Yes. But, when adjusting the runtime, be careful to distinguish aborts that are really intended to be aborts from assertions!


I'm confused. How is this different to adjusting the compiler?  Each
abort is either 'we can't get here' (in which case it should be
gcc_unreachable), or 'the condition protecting this is never true' (in
which case it should be gcc_assert), or 'we've got scrogged input'
(in which case some kind of error would be appropriate -- do we want a
gcc_fatal for those?).

There might be situations where we can't print anything, but still need to abort. Like std::terminate, for example, or perhaps things in the exception unwinder. (You can't safely call "printf" during exception-unwinding because the exception might in a signal handler, and you can't safely call "printf" from a signal handler.)


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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