fix dwarf2 abort on STMT_EXPR

Richard Henderson rth@redhat.com
Thu Jun 5 18:09:00 GMT 2003


Affects a glibc build with mainline gcc.


r~


        * dwarf2out.c (loc_descriptor_from_tree): Return 0 for 
        language-specific tree codes.

Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.428
diff -c -p -d -r1.428 dwarf2out.c
*** dwarf2out.c	4 Jun 2003 17:19:36 -0000	1.428
--- dwarf2out.c	5 Jun 2003 18:01:55 -0000
*************** loc_descriptor_from_tree (loc, addressp)
*** 9033,9038 ****
--- 9033,9046 ----
        break;
  
      default:
+       /* Leave front-end specific codes as simply unknown.  This comes
+ 	 up, for instance, with the C STMT_EXPR.  */
+       if ((unsigned int) TREE_CODE (loc)
+           >= (unsigned int) LAST_AND_UNUSED_TREE_CODE)
+ 	return 0;
+ 
+       /* Otherwise this is a generic code; we should just lists all of
+ 	 these explicitly.  Aborting means we forgot one.  */
        abort ();
      }
  
Index: testsuite/gcc.dg/debug/20030605-1.c
===================================================================
RCS file: testsuite/gcc.dg/debug/20030605-1.c
diff -N testsuite/gcc.dg/debug/20030605-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/debug/20030605-1.c	5 Jun 2003 18:01:56 -0000
***************
*** 0 ****
--- 1,7 ----
+ /* Verify we don't ICE on statement-expressions.  */
+ /* { dg-do compile } */
+ 
+ void foo(void)
+ {
+   char buf[({ 4; })];
+ }



More information about the Gcc-patches mailing list