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]

[testsuite] Yet another gcc segfault on lame input


Hi!

gcc segfaults on the following testcase. One issue is that block_stack is
NULL, which expand_end_bindings is not expecting (below is a possible stmt.c
change but I'm not sure whether that's the best solution), but if I apply
the stmt.c patch, it segfaults in yet another place. Any ideas on how to
solve these nicely and without slowing down compilation for properly written
programs?

2000-09-01  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/noncompile/20000901-2.c: New test.

--- gcc/testsuite/gcc.dg/noncompile/20000901-2.c.jj	Fri Sep  1 17:11:43 2000
+++ gcc/testsuite/gcc.dg/noncompile/20000901-2.c	Fri Sep  1 17:17:44 2000
@@ -0,0 +1,18 @@
+unsigned char c;
+
+int foo()
+{
+  switch (c)
+    {
+      case 0:
+	switch (a->b)	/* { dg-error "undeclared|for each function" } */
+	  {
+	    case 0:	/* { dg-error "duplicate case" } */
+	      break;
+	  }
+}
+void bar()		/* { dg-error "parse error" } */
+{
+  n = 0;
+}
+

--- gcc/stmt.c.jj	Fri Sep  1 10:13:37 2000
+++ gcc/stmt.c	Fri Sep  1 17:01:28 2000
@@ -3586,6 +3586,9 @@ expand_end_bindings (vars, mark_ends, do
 {
   register struct nesting *thisblock;
 
+  if (!block_stack)
+    return;
+
   while (block_stack->data.block.exception_region)
     {
       /* Because we don't need or want a new temporary level and

	Jakub

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