On Wednesday 19 August 2009 18:01, Chris Lattner wrote:> > It's not about recovery, it's about message reporting. Right now > > the LLVM > > abort messages are formatted completely differently than aborts from > > other > > parts of our compiler. That's not friendly to users. > > This is what ErrorReporting.h is all about.But asserts and aborts don't go through that, right? What's needed is a way to get those assert and abort messages out to other compiler components so they have a chance to report them nicely to the user. Again, it's not a critical issue right now, just one I've thought about from time to time. -Dave
On Aug 19, 2009, at 4:05 PM, David Greene wrote:> On Wednesday 19 August 2009 18:01, Chris Lattner wrote: > >>> It's not about recovery, it's about message reporting. Right now >>> the LLVM >>> abort messages are formatted completely differently than aborts from >>> other >>> parts of our compiler. That's not friendly to users. >> >> This is what ErrorReporting.h is all about. > > But asserts and aborts don't go through that, right? What's needed is > a way to get those assert and abort messages out to other compiler > components so they have a chance to report them nicely to the user.assert and abort should never happen, just like a null pointer or garbage pointer dereference should never happen. How are garbage pointer and asserts different? -Chris
Chris Lattner <clattner at apple.com> writes:>>>> It's not about recovery, it's about message reporting. Right now >>>> the LLVM >>>> abort messages are formatted completely differently than aborts from >>>> other >>>> parts of our compiler. That's not friendly to users. >>> >>> This is what ErrorReporting.h is all about. >> >> But asserts and aborts don't go through that, right? What's needed is >> a way to get those assert and abort messages out to other compiler >> components so they have a chance to report them nicely to the user. > > assert and abort should never happen, just like a null pointer or > garbage pointer dereference should never happen. How are garbage > pointer and asserts different?Well, an assert says the compiler is broken, but the compiler may be just another component of a large application. You are thinking on terms of a traditional edit-run-crash compiler and on this scenario you are right. No so for a JIT embedded on a server, where it plays a secondary role and it is not allowed to bring down the server because some random piece of code uncovers a bug on the compiler or the LLVM backend. -- Óscar
On Wed, Aug 19, 2009 at 4:17 PM, Chris Lattner<clattner at apple.com> wrote:> > assert and abort should never happen, just like a null pointer or > garbage pointer dereference should never happen. How are garbage > pointer and asserts different?So what should we use to validate input, such as constructing an APFloat from a string? llvm_report_error? Or should I change my string parsing function into a classmethod that returns pointer to an APFloat or null on failure?
On Wednesday 19 August 2009 18:17, Chris Lattner wrote:> > But asserts and aborts don't go through that, right? What's needed is > > a way to get those assert and abort messages out to other compiler > > components so they have a chance to report them nicely to the user. > > assert and abort should never happen, just like a null pointer or > garbage pointer dereference should never happen. How are garbage > pointer and asserts different?And programs should never have bugs either. The reality is, they do. And when we screw up, we owe it to our users to give them as much information as possible and gracefully exit. We can't do that right now with the current LLVM assert/abort scheme. -Dave