Commit 145357a4 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 75829da2
2005-06-07 Jakub Jelinek <jakub@redhat.com>
PR middle-end/21850
* tree.c (get_unwidened): Stop at NOP_EXPR/CONVERT_EXPR that convert
from vector types.
2005-06-07 Diego Novillo <dnovillo@redhat.com> 2005-06-07 Diego Novillo <dnovillo@redhat.com>
* tree-ssa-threadupdate.c (struct thread_stats_d): Declare. * tree-ssa-threadupdate.c (struct thread_stats_d): Declare.
......
2005-06-07 Jakub Jelinek <jakub@redhat.com>
PR middle-end/21850
* gcc.c-torture/execute/20050607-1.c: New test.
2005-06-07 Thomas Koenig <Thomas.Koenig@online.de> 2005-06-07 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/21926 PR libfortran/21926
......
/* PR middle-end/21850 */
extern void abort (void);
typedef int V2SI __attribute__ ((vector_size (8)));
int
main (void)
{
#if (__INT_MAX__ == 2147483647) \
&& (__LONG_LONG_MAX__ == 9223372036854775807LL)
if (((int)(long long)(V2SI){ 2, 2 }) != 2)
abort ();
#endif
return 0;
}
...@@ -4937,9 +4937,16 @@ get_unwidened (tree op, tree for_type) ...@@ -4937,9 +4937,16 @@ get_unwidened (tree op, tree for_type)
while (TREE_CODE (op) == NOP_EXPR while (TREE_CODE (op) == NOP_EXPR
|| TREE_CODE (op) == CONVERT_EXPR) || TREE_CODE (op) == CONVERT_EXPR)
{ {
int bitschange int bitschange;
= TYPE_PRECISION (TREE_TYPE (op))
- TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op, 0))); /* 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. /* Truncations are many-one so cannot be removed.
Unless we are later going to truncate down even farther. */ Unless we are later going to truncate down even farther. */
......
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