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]

Fix for comparing CONSTRUCTOR_ELTS constants [patch]


I found this problem with the tree-ssa constant propagator.
Several c-torture tests were failing with an ICE when we called 
simple_cst_equal with two CONSTRUCTOR constants that were the
same but were unshared by the simplifier (e.g.,
gcc.c-torture/compile/simd-1.c):

    v2si x = { 1, 2 };
    foo((di) x);

This patch changes simple_cst_equal to call simple_cst_list_equal
to compare CONSTRUCT_ELTS lists.  It's not a regression because
only the tree-ssa branch unshares trees.  Would it be OK to merge
this after the 3.3 branch is created?


Diego.

	* tree.c (simple_cst_equal): Call simple_cst_list_equal to compare
	CONSTRUCTOR_ELTS pointers.

Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.263.2.6
diff -d -u -p -r1.263.2.6 tree.c
--- tree.c	12 Aug 2002 01:33:21 -0000	1.263.2.6
+++ tree.c	22 Aug 2002 16:56:11 -0000
@@ -3384,10 +3384,8 @@ simple_cst_equal (t1, t2)
 			 TREE_STRING_LENGTH (t1)));
 
     case CONSTRUCTOR:
-      if (CONSTRUCTOR_ELTS (t1) == CONSTRUCTOR_ELTS (t2))
-	return 1;
-      else
-	abort ();
+      return simple_cst_list_equal (CONSTRUCTOR_ELTS (t1), 
+	                            CONSTRUCTOR_ELTS (t2));
 
     case SAVE_EXPR:
       return simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));


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