From: Richard Guenther Date: Thu, 7 Oct 2010 14:32:20 +0000 (+0000) Subject: re PR middle-end/45869 (type mismatch in shift expression produces ice with -O3 and... X-Git-Tag: releases/gcc-4.6.0~3788 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65dcb9012117bf260ab72b9703e659685e9877e4;p=thirdparty%2Fgcc.git re PR middle-end/45869 (type mismatch in shift expression produces ice with -O3 and -m32) 2010-10-07 Richard Guenther PR middle-end/45869 * tree-cfg.c (verify_gimple_assign_binary): Allow vector shifts of pointers. * gcc.dg/torture/pr45869.c: New testcase. From-SVN: r165113 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e18f7008a5d0..2768905ea87b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-07 Richard Guenther + + PR middle-end/45869 + * tree-cfg.c (verify_gimple_assign_binary): Allow vector shifts + of pointers. + 2010-10-07 Alan Modra * config/rs6000/rs6000.c (rs6000_emit_prologue): Use gen_int_mode diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f78e4962bd6c..515582ed7fe2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-07 Richard Guenther + + PR middle-end/45869 + * gcc.dg/torture/pr45869.c: New testcase. + 2010-10-07 Iain Sandoe * objc.dg/set-not-used-1.m: New diff --git a/gcc/testsuite/gcc.dg/torture/pr45869.c b/gcc/testsuite/gcc.dg/torture/pr45869.c new file mode 100644 index 000000000000..e01977bf9fb0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr45869.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +char * +foo (unsigned int count, void **list) +{ + char *minaddr = (char *) list[0]; + unsigned int i; /* NOTE: change of type to "int" eliminates the ICE */ + for (i = 1; i < count; i++) + { + char *addr = (char *) list[i]; + if (addr < minaddr) + minaddr = addr; + } + return minaddr; +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index cf67fb8613ef..d1ee63a31324 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3422,6 +3422,7 @@ verify_gimple_assign_binary (gimple stmt) { if (TREE_CODE (rhs1_type) != VECTOR_TYPE || !(INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type)) + || POINTER_TYPE_P (TREE_TYPE (rhs1_type)) || FIXED_POINT_TYPE_P (TREE_TYPE (rhs1_type)) || SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type))) || (!INTEGRAL_TYPE_P (rhs2_type) @@ -3435,9 +3436,9 @@ verify_gimple_assign_binary (gimple stmt) debug_generic_expr (rhs2_type); return true; } - /* For shifting a vector of floating point components we + /* For shifting a vector of non-integral components we only allow shifting by a constant multiple of the element size. */ - if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type)) + if (!INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type)) && (TREE_CODE (rhs2) != INTEGER_CST || !div_if_zero_remainder (EXACT_DIV_EXPR, rhs2, TYPE_SIZE (TREE_TYPE (rhs1_type)))))