This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix fold_checking after Kenner added more tree checking
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 13 Jun 2004 18:14:32 -0400 (EDT)
- Subject: [committed] Fix fold_checking after Kenner added more tree checking
Serge Belyshev reported this in IRC and I figured out what was
going wrong. When Kenner added some more tree-checking he
had forgot to test with fold-checking also turned on to
see if he had to change anything there. This patch
fixes the two problems which was reported so far,
I have not checked to see if there was any other problems
yet.
I committed this as obvious to get fold-checking further.
Thanks,
Andrew Pinski
ChangeLog:
* fold-const.c (fold_checksum_tree <case 't'>): Only
look at TREE_VALUES if the EXPR is an ENUMERAL_TYPE.
Only look at TYPE_MIN_VALUE and TYPE_MAX_VALUE if
EXPR is an INTEGERAL_TYPE or a scalar float type.
Patch:
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.394
diff -u -p -r1.394 fold-const.c
--- fold-const.c 12 Jun 2004 19:41:49 -0000 1.394
+++ fold-const.c 13 Jun 2004 22:08:22 -0000
@@ -8731,13 +8731,18 @@ fold_checksum_tree (tree expr, struct md
fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
break;
case 't':
- fold_checksum_tree (TYPE_VALUES (expr), ctx, ht);
+ if (TREE_CODE (expr) == ENUMERAL_TYPE)
+ fold_checksum_tree (TYPE_VALUES (expr), ctx, ht);
fold_checksum_tree (TYPE_SIZE (expr), ctx, ht);
fold_checksum_tree (TYPE_SIZE_UNIT (expr), ctx, ht);
fold_checksum_tree (TYPE_ATTRIBUTES (expr), ctx, ht);
fold_checksum_tree (TYPE_NAME (expr), ctx, ht);
- fold_checksum_tree (TYPE_MIN_VALUE (expr), ctx, ht);
- fold_checksum_tree (TYPE_MAX_VALUE (expr), ctx, ht);
+ if (INTEGRAL_TYPE_P (expr)
+ || SCALAR_FLOAT_TYPE_P (expr))
+ {
+ fold_checksum_tree (TYPE_MIN_VALUE (expr), ctx, ht);
+ fold_checksum_tree (TYPE_MAX_VALUE (expr), ctx, ht);
+ }
fold_checksum_tree (TYPE_MAIN_VARIANT (expr), ctx, ht);
fold_checksum_tree (TYPE_BINFO (expr), ctx, ht);
fold_checksum_tree (TYPE_CONTEXT (expr), ctx, ht);