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]

[PATCH] Don't abort in C++ emit_local_var


Hi!

The following testsuite fails with -O2 and above (in fact what matters is
-foptimize-sibling-calls).
The reason is that the compound statement is expanded twice with -O2 (in
addition to precompute_arguments from store_one_arg due to sibling call
optimization).
If I remove the assert, everything works just fine and the resulting code looks
ok. Is there something wrong with emit_local_var being called twice?
Those two invocations go into different rtl chains from which only one is
chosen...

2000-06-21  Jakub Jelinek  <jakub@redhat.com>

	* decl.c (emit_local_var): Silently allow any decl to have DECL_RTL
	already attached.

	* g++.old-deja/g++.other/stmtexpr2.C: New test.

--- gcc/testsuite/g++.old-deja/g++.other/stmtexpr2.C.jj	Wed Jun 21 10:58:25 2000
+++ gcc/testsuite/g++.old-deja/g++.other/stmtexpr2.C	Wed Jun 21 10:58:50 2000
@@ -0,0 +1,9 @@
+// Build don't link:
+// Special g++ Options: -O2
+// Origin: Jakub Jelinek <jakub@redhat.com>
+
+void bar(int);
+void foo(int x)
+{
+  bar(({ int y; y = x; }));
+}
--- gcc/cp/decl.c.jj	Fri Jun 16 13:10:38 2000
+++ gcc/cp/decl.c	Wed Jun 21 10:50:36 2000
@@ -8040,12 +8040,7 @@ emit_local_var (decl)
      tree decl;
 {
   /* Create RTL for this variable.  */
-  if (DECL_RTL (decl))
-    /* Only a RESULT_DECL should have non-NULL RTL when arriving here.
-       All other local variables are assigned RTL in this function.  */
-    my_friendly_assert (TREE_CODE (decl) == RESULT_DECL,
-			19990828);
-  else
+  if (! DECL_RTL (decl))
     {
       if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
 	/* The user must have specified an assembler name for this

	Jakub

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