Commit 417ac4e6 by Kazu Hirata Committed by Kazu Hirata

re PR tree-optimization/21021 (ICE in tree-vrp building glibc)

gcc/
	PR tree-optimization/21021
	* tree-vrp.c (compare_values): Work around a bug in the front
	end that produces a comparison of mismatched types.

testsuite/
	PR tree-optimization/21021
	* gcc.c-torture/compile/pr21021.c: New.

From-SVN: r98161
parent 6f4dfa2b
2005-04-14 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/21021
* tree-vrp.c (compare_values): Work around a bug in the front
end that produces a comparison of mismatched types.
2004-04-14 Richard Henderson <rth@redhat.com>
* config/ia64/ia64.h (enum fetchop_code): Remove.
......
2005-04-14 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/21021
* gcc.c-torture/compile/pr21021.c: New.
2005-04-14 Janis Johnson <janis187@us.ibm.com
PR testsuite/21010
......
/* PR tree-optimization/21021
The front end produces a comparison of mismatched types, namely an
integer and a pointer, causing VRP to compute TYPE_MAX_VALUE for a
pointer, which we cannot. */
extern void *bar (void);
int
foo (unsigned int *p, unsigned int *q)
{
const void *r = bar ();
if (r >= (const void *) *p
&& r < (const void *) *q)
return 1;
return 0;
}
......@@ -287,7 +287,13 @@ compare_values (tree val1, tree val2)
return 0;
/* Do some limited symbolic comparisons. */
if (!POINTER_TYPE_P (TREE_TYPE (val1)))
/* FIXME: The second check of POINTER_TYPE_P should not be necessary
because we should be comparing values of the same type here, but
for whatever reason, the front end throws us a type mismatched
comparison. For now, work around the problem by checking both
types. See PR 21021 and PR 21024. */
if (!POINTER_TYPE_P (TREE_TYPE (val1))
&& !POINTER_TYPE_P (TREE_TYPE (val2)))
{
/* We can determine some comparisons against +INF and -INF even
if the other value is an expression. */
......@@ -400,7 +406,13 @@ compare_values (tree val1, tree val2)
if (!is_gimple_min_invariant (val1) || !is_gimple_min_invariant (val2))
return -2;
if (!POINTER_TYPE_P (TREE_TYPE (val1)))
/* FIXME: The second check of POINTER_TYPE_P should not be necessary
because we should be comparing values of the same type here, but
for whatever reason, the front end throws us a type mismatched
comparison. For now, work around the problem by checking both
types. See PR 21021 and PR 21024. */
if (!POINTER_TYPE_P (TREE_TYPE (val1))
&& !POINTER_TYPE_P (TREE_TYPE (val2)))
return tree_int_cst_compare (val1, val2);
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment