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]

[PATCH] Fix PR 28980, ICE with some VLA with functions and -g


The problem here is that loc_descriptor_from_tree_1 is not ready to
handle FUNCTION_DECL so we get a crash.  This fixes the crash by
handling FUNCTION_DECL like any other decl would be handled.

OK? Bootstrapped and tested on i686-linux-gnu.

:ADDPATCH debug:

Thanks,
Andrew Pinski

ChangeLog:

	* dwarf2out.c (loc_descriptor_from_tree_1): Handle
	FUNCTION_DECL.

testsuite/ChangeLog:
	* gcc.c-torture/compile/debugvlafunction-1.c: New test.
Index: testsuite/gcc.c-torture/compile/debugvlafunction-1.c
===================================================================
--- testsuite/gcc.c-torture/compile/debugvlafunction-1.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/debugvlafunction-1.c	(revision 0)
@@ -0,0 +1,11 @@
+extern void dynreplace_trampoline(void);
+extern void dynreplace_trampoline_endlabel(void);
+int dynreplace_add_trampoline(void)
+{
+  unsigned long trampoline_code[(((unsigned long)
+(&(dynreplace_trampoline_endlabel))
+-(unsigned long) (&dynreplace_trampoline)))
+];
+}
+
+
Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 116919)
+++ dwarf2out.c	(working copy)
@@ -9167,6 +9167,7 @@ loc_descriptor_from_tree_1 (tree loc, in
       /* FALLTHRU */
 
     case RESULT_DECL:
+    case FUNCTION_DECL:
       {
 	rtx rtl = rtl_for_decl_location (loc);
 

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