This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR tree-optimization/18663
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 20 Feb 2005 23:09:23 +0100
- Subject: [PATCH] Fix PR tree-optimization/18663
Hi,
This is the ACATS failure
FAIL: cc1221d
on IA-32, AMD64, IA-64 and PowerPC.
We have a tree checking failure at
extract_range_from_cond:
case GT_EXPR:
high = TYPE_MAX_VALUE (type);
if (!tree_int_cst_lt (op1, high))
return 0;
low = int_const_binop (PLUS_EXPR, op1, integer_one_node, 1);
inverted = 0;
break;
because the TYPE_MAX_VALUE of
SUBTYPE SINT1 IS INT
RANGE INT (IDENT_INT (-4)) .. INT (IDENT_INT (4));
is not an INTEGER_CST (it's a VAR_DECL).
The proposed fix is to give up in that case. Bootstrapped/regtested on
i586-redhat-linux-gnu.
2005-02-20 Eric Botcazou <ebotcazou@libertysurf.fr>
PR tree-optimization/18663
* tree-ssa-dom.c (extract_range_from_cond): Return 0
if the type has variable bounds.
--
Eric Botcazou
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.92
diff -u -p -r2.92 tree-ssa-dom.c
--- tree-ssa-dom.c 17 Feb 2005 16:19:44 -0000 2.92
+++ tree-ssa-dom.c 20 Feb 2005 16:37:18 -0000
@@ -3189,16 +3189,19 @@ extract_range_from_cond (tree cond, tree
tree op1 = TREE_OPERAND (cond, 1);
tree high, low, type;
int inverted;
-
+
+ type = TREE_TYPE (op1);
+
/* Experiments have shown that it's rarely, if ever useful to
record ranges for enumerations. Presumably this is due to
the fact that they're rarely used directly. They are typically
cast into an integer type and used that way. */
- if (TREE_CODE (TREE_TYPE (op1)) != INTEGER_TYPE)
+ if (TREE_CODE (type) != INTEGER_TYPE
+ /* We don't know how to deal with types with variable bounds. */
+ || TREE_CODE (TYPE_MIN_VALUE (type)) != INTEGER_CST
+ || TREE_CODE (TYPE_MAX_VALUE (type)) != INTEGER_CST)
return 0;
- type = TREE_TYPE (op1);
-
switch (TREE_CODE (cond))
{
case EQ_EXPR: