aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-07 23:45:07 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2005-06-07 23:45:07 +0200
commit145357a492e6ebd91f4c11f27f5682be8000ebec (patch)
tree289feaa6967e1edfb56b045c346f8586a45ab2ef /gcc/tree.c
parent75829da2a941c239cb2ba258ea2b58700fd39264 (diff)
downloadgcc-145357a492e6ebd91f4c11f27f5682be8000ebec.zip
gcc-145357a492e6ebd91f4c11f27f5682be8000ebec.tar.gz
gcc-145357a492e6ebd91f4c11f27f5682be8000ebec.tar.bz2
re PR middle-end/21850 (misscompiling comparision from vector to integer)
PR middle-end/21850 * tree.c (get_unwidened): Stop at NOP_EXPR/CONVERT_EXPR that convert from vector types. * gcc.c-torture/execute/20050607-1.c: New test. From-SVN: r100725
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 15488fb..2f5f924 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4937,9 +4937,16 @@ get_unwidened (tree op, tree for_type)
while (TREE_CODE (op) == NOP_EXPR
|| TREE_CODE (op) == CONVERT_EXPR)
{
- int bitschange
- = TYPE_PRECISION (TREE_TYPE (op))
- - TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op, 0)));
+ int bitschange;
+
+ /* TYPE_PRECISION on vector types has different meaning
+ (TYPE_VECTOR_SUBPARTS) and casts from vectors are view conversions,
+ so avoid them here. */
+ if (TREE_CODE (TREE_TYPE (TREE_OPERAND (op, 0))) == VECTOR_TYPE)
+ break;
+
+ bitschange = TYPE_PRECISION (TREE_TYPE (op))
+ - TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op, 0)));
/* Truncations are many-one so cannot be removed.
Unless we are later going to truncate down even farther. */