From: kazu Date: Fri, 15 Apr 2005 01:29:44 +0000 (+0000) Subject: gcc/ X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af9164b29d06cfb3da49b3bed9d619b45a0633d1;p=thirdparty%2Fgcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98161 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb8f4db0ea4b..df5952980211 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-04-14 Kazu Hirata + + 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 * config/ia64/ia64.h (enum fetchop_code): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28f04d35904f..eed557ebda18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-14 Kazu Hirata + + PR tree-optimization/21021 + * gcc.c-torture/compile/pr21021.c: New. + 2005-04-14 Janis Johnson = (const void *) *p + && r < (const void *) *q) + return 1; + + return 0; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 014f1956926e..41cf6e1806b2 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -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 {