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]

[testcase] Removed lexical scopes ICE (was Re: scheduling vs lexical scopes)


On Thu, Dec 27, 2001 at 03:16:18PM -0800, Richard Henderson wrote:
> So the outstanding dwarf2 question is: how do we prevent crashes in
> this situation?  I'm not sure that we can ever completely prevent
> this situation from occurring.

Unfortunately, there are other problems (which prevent glibc bootstrap)
which aren't cured by your patch.
The first testcase looses because during sched2 all of first subblock
is merged into second subblock and thus baz has no origin scope.
Before bbro, we have the first subblock containing 0 insns:
(note 77 3 5 [bb 0] NOTE_INSN_BASIC_BLOCK)
(note 5 77 8 0x401b5d80 NOTE_INSN_BLOCK_BEG)
(note 8 5 23 0x401b5d00 NOTE_INSN_BLOCK_BEG)
(note 23 8 24 0x401b5d00 NOTE_INSN_BLOCK_END)
(note 24 23 96 0x401b5d40 NOTE_INSN_BLOCK_BEG)
where 0x401b5d80 is block containing e, 0x401b5d00 block containing baz and
0x401b5d40 block containing f, which means baz's block will have num_bbs 0
and not be reinserted after final cfg is done.
The second testcase doesn't have NOTE_INSN_BLOCK_{BEGIN,END} notes emitted
even in rtl dump.
Ok to commit the testcases?
Any ideas on what can be done about this (especially debug-4: the best would
be not emit baz.0 at all)?

2001-12-28  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/debug-3.c: New test.
	* gcc.dg/debug-4.c: New test.

--- gcc/testsuite/gcc.dg/debug-3.c.jj	Thu Aug 30 22:30:55 2001
+++ gcc/testsuite/gcc.dg/debug-3.c	Fri Dec 28 17:27:32 2001
@@ -0,0 +1,35 @@
+/* This testcase failed, because scope containing baz was deleted
+   (spanned 0 basic blocks) and DWARF-2 couldn't find baz origin.  */
+/* { dg-do compile } */
+/* { dg-options "-O3 -g" } */
+
+struct A { char *a, *b, *c, *d; };
+
+static int
+bar (struct A *x)
+{
+  return x->c - x->b;
+}
+
+void fnptr (void (*fn) (void));
+
+void
+foo (void)
+{
+  struct A e;
+
+  {
+    void baz (void)
+      {
+	bar (&e);
+      }
+    fnptr (baz);
+  }
+  {
+    struct A *f;
+
+    f = &e;
+    if (f->c - f->a > f->d - f->a)
+      f->c = f->d;
+  }
+}
--- gcc/testsuite/gcc.dg/debug-4.c.jj	Thu Aug 30 22:30:55 2001
+++ gcc/testsuite/gcc.dg/debug-4.c	Fri Dec 28 17:28:09 2001
@@ -0,0 +1,27 @@
+/* This testcase failed, because scope containing baz was not emitted
+   (doesn't contain any instructions) and DWARF-2 couldn't find baz origin.  */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+struct A { char *a, *b, *c, *d; };
+
+static int
+bar (struct A *x)
+{
+  return x->c - x->b;
+}
+
+void
+foo (void)
+{
+  struct A e;
+
+  {
+    int baz (void)
+      {
+	return bar (&e);
+      }
+  }
+  if (e.c - e.a > e.d - e.a)
+    e.c = e.d;
+}

	Jakub


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