From c3f216e234fe475b33532d5ac54dbde1aaa67a05 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 24 Aug 2004 02:10:12 +0000 Subject: [PATCH] re PR debug/14492 (loc_descriptor_from_tree, in dwarf2out.c:9031) PR c/14492 * dwarf2out.c (loc_descriptor_from_tree): Robustify. PR c/14492 * gcc.dg/debug/crash1.c: New test. From-SVN: r86461 --- gcc/ChangeLog | 5 +++++ gcc/dwarf2out.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/debug/crash1.c | 8 ++++++++ 4 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/crash1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0667a1ad998..89100e9e4aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-08-23 Mark Mitchell + + PR c/14492 + * dwarf2out.c (loc_descriptor_from_tree): Robustify. + 2004-08-23 Diego Novillo * cfg.c (check_bb_profile): Fix typos. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 4d9a1b2b25e..02cbef3df93 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9244,9 +9244,15 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) >= (unsigned int) LAST_AND_UNUSED_TREE_CODE) return 0; +#ifdef ENABLE_CHECKING /* Otherwise this is a generic code; we should just lists all of these explicitly. Aborting means we forgot one. */ abort (); +#else + /* In a release build, we want to degrade gracefully: better to + generate incomplete debugging information than to crash. */ + return NULL; +#endif } /* Show if we can't fill the request for an address. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a3fde266bb..5c688632e9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-23 Mark Mitchell + + PR c/14492 + * gcc.dg/debug/crash1.c: New test. + 2004-08-23 Mark Mitchell PR c/16180 diff --git a/gcc/testsuite/gcc.dg/debug/crash1.c b/gcc/testsuite/gcc.dg/debug/crash1.c new file mode 100644 index 00000000000..259e259f422 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/crash1.c @@ -0,0 +1,8 @@ +/* PR c/14492 */ +/* { dg-options "" } */ + +int main() { + double d = 1.0; + char x[(int) d]; + return 0; +} -- 2.30.2