re PR debug/14492 (loc_descriptor_from_tree, in dwarf2out.c:9031)
authorMark Mitchell <mark@codesourcery.com>
Tue, 24 Aug 2004 02:10:12 +0000 (02:10 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 24 Aug 2004 02:10:12 +0000 (02:10 +0000)
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
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/crash1.c [new file with mode: 0644]

index 0667a1ad998828cee4cf4c435cadcf9fc5d67b82..89100e9e4aa0d881aa04645518e9a68359606c23 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-23  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c/14492
+       * dwarf2out.c (loc_descriptor_from_tree): Robustify.
+
 2004-08-23  Diego Novillo  <dnovillo@redhat.com>
 
        * cfg.c (check_bb_profile): Fix typos.
index 4d9a1b2b25e9f1597c46c8abfafeb8f9dd6948d7..02cbef3df9387216d256fc7694db569a22f59c48 100644 (file)
@@ -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.  */
index 7a3fde266bb4a0cc24948587e79d5e3cc71430a6..5c688632e9e61bc5b934be19139438ef449c4686 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-23  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c/14492
+       * gcc.dg/debug/crash1.c: New test.
+
 2004-08-23  Mark Mitchell  <mark@codesourcery.com>
 
        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 (file)
index 0000000..259e259
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR c/14492 */
+/* { dg-options "" } */
+
+int main() {
+  double d = 1.0;
+  char x[(int) d];
+  return 0;
+}