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] Correct test for empty set.


I propose the following patch:
In function `initializer_zerop' in tree.c test for empty set 
was incorrect -- the function treated one element set with
the element beeing 0 as empty set.

The problem show in `mir029el.pas' test from GNU Pascal test suite 
(AFAIK no standard front end uses sets).

I have bootstraped gcc-3.4-20031015 (the latest snapshot where I am able 
to build Ada) on i386-linux (Debian Woody on Athlon XP). I ran the 
testsuite and I saw no new failures.

ChangeLog:
        * tree.c (initializer_zerop): Add test for empty set. 

diff -ru gcc-3.4-20031015.orig/gcc/tree.c gcc-3.4-20031015/gcc/tree.c
--- gcc-3.4-20031015.orig/gcc/tree.c	Mon Oct  6 15:50:39 2003
+++ gcc-3.4-20031015/gcc/tree.c	Sun Nov 16 16:46:51 2003
@@ -4979,6 +4979,10 @@
 	    && ! REAL_VALUE_MINUS_ZERO (TREE_REAL_CST (TREE_IMAGPART (init))));
     case CONSTRUCTOR:
       {
+	/* Set is empty if it has no elements */
+        if ((TREE_CODE (TREE_TYPE (init)) == SET_TYPE)
+             && CONSTRUCTOR_ELTS (init))
+	  return false;
 	if (AGGREGATE_TYPE_P (TREE_TYPE (init)))
 	  {
 	    tree aggr_init = CONSTRUCTOR_ELTS (init);
Only in gcc-3.4-20031015/gcc: tree.c.orig

-- 
                              Waldek Hebisch
hebisch@math.uni.wroc.pl 


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