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: PATCH: Robustify loc_descriptor_from_tree


Daniel Jacobowitz wrote:

On Mon, Aug 23, 2004 at 07:11:59PM -0700, Mark Mitchell wrote:


This patch fixes PR c/14492, a crash in the debug-generators with
VLAs.

The code in loc_descriptor_from_tree aborts if it runs into a
tree-code it doesn't recognize.  This is fine for the development
branch; we want to find out about these things and add support for
them.  But, it's foolish for a release branch, since it's easy to
degrade gracefully.  Our users would rather have their code compile,
and find out later than they can't print out an array bound in the
debugger, than have the code fail to compile at all.

Tested on i686-pc-linux-gnu, applied on the 3.4 branch and on the
mainline.



Is this really a good idea? It's something that is unsupported - an internal error. It'd take hours to work out that the compiler had bizarrely punted on debug information for some variable.

This is more like Nathan's proposed switch for --disable-asserts, than
it is like the existing --disable-checking, IMO.

I think debug info is in a different category.

If the user tries to compile with -g, and we do everything just right, but can't figure out how to emit debug info for the bounds in a VLA, I'd be amazed if most users would want us to crash. We'll still be generating correct (but incomplete) debug information, so it's not even like running the debugger should fall over. We were already silently punting for some trees; this just makes us punt for those that we don't recognize.

The difference, in my mind, from Nathan's proposal, is that there's no chance of us generating bad code from this patch. We're just saying "gee, we don't know how to do that." If you really pressed me, I might be persuaded that we should issue a warning saying "we're too dumb to emit debug-info for X," but I don't think most users want to know.

If someone ever reports a problem debugging such a program (unlikely, IMO), then you can also use a --enable-checking compiler to find the problem. (I almost always debug problems with an --enable-checking compiler, just so that I don't have to track down silly violations of the type system, for example.)

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


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