This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Correct test for empty set.
- From: Waldek Hebisch <hebisch at math dot uni dot wroc dot pl>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 16 Nov 2003 20:51:52 +0100 (MET)
- Subject: [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