This is the mail archive of the 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.

        * 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 @@
     case CONSTRUCTOR:
+	/* Set is empty if it has no elements */
+        if ((TREE_CODE (TREE_TYPE (init)) == SET_TYPE)
+             && CONSTRUCTOR_ELTS (init))
+	  return false;
 	    tree aggr_init = CONSTRUCTOR_ELTS (init);
Only in gcc-3.4-20031015/gcc: tree.c.orig

                              Waldek Hebisch 

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