diff options
author | Paolo Bonzini <bonzini@gcc.gnu.org> | 2004-08-17 07:40:22 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2004-08-17 07:40:22 +0000 |
commit | 62fc1d7d18d061f34e73957b3e87511fdc5de3ba (patch) | |
tree | 33105d56679d89ea93b190dc2049f0985565fe47 | |
parent | 7c27e184c87d2b245f80287be1d28f686b68519e (diff) | |
download | gcc-62fc1d7d18d061f34e73957b3e87511fdc5de3ba.zip gcc-62fc1d7d18d061f34e73957b3e87511fdc5de3ba.tar.gz gcc-62fc1d7d18d061f34e73957b3e87511fdc5de3ba.tar.bz2 |
re PR middle-end/17036 (ICE: (A >> N) & 1 ? (1 << N) : 0 where A of type unsigned int)
gcc/ChangeLog:
2004-08-17 Paolo Bonzini <bonzini@gnu.org>
PR middle-end/17036
* fold-const.c (fold): Check for integer operand when
folding (A >> N) & 1 ? (1 << N) : 0. Fix from Andrew
Pinski <pinskia@physics.uc.edu>.
gcc/testsuite/ChangeLog:
2004-08-17 Paolo Bonzini <bonzini@gnu.org>
* gcc.dg/pr17036-1.c: New test.
From-SVN: r86112
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/fold-const.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr17036-1.c | 11 |
4 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7f581a9..ece9c7b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2004-08-17 Paolo Bonzini <bonzini@gnu.org> + PR middle-end/17036 + * fold-const.c (fold): Check for integer operand when + folding (A >> N) & 1 ? (1 << N) : 0. Fix from Andrew + Pinski <pinskia@physics.uc.edu>. + +2004-08-17 Paolo Bonzini <bonzini@gnu.org> + * configure.ac: Trust toplevel's notion of BISON/FLEX/MAKEINFO. No need to check if in a cross configuration. * configure: Regenerate. @@ -131,10 +138,9 @@ 2004-08-16 Nathanael Nerode <neroden@gcc.gnu.org> * tree-ssa-copyrename.c (copy_rename_partition_coalesce): - Check for arificial variables, not is_gimple_tmp_var. + Check for artificial variables, not is_gimple_tmp_var. * tree-ssa-live.c (var_union): Likewise. ->>>>>>> 2.4930 2004-08-16 Nathan Sidwell <nathan@codesourcery.com> * calls.c (load_register_parameters): Remove spurious FIXME token. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c404613..319e455 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8859,6 +8859,7 @@ fold (tree expr) tree tem = TREE_OPERAND (arg0, 0); STRIP_NOPS (tem); if (TREE_CODE (tem) == RSHIFT_EXPR + && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST && (unsigned HOST_WIDE_INT) tree_log2 (arg1) == TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))) return fold (build2 (BIT_AND_EXPR, type, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 319fe1d..0f65b73 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-08-17 Paolo Bonzini <bonzini@gnu.org> + + * gcc.dg/pr17036-1.c: New test. + 2004-08-16 Devang Patel <dpatel@apple.com> * gcc.dg/darwin-20040809-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr17036-1.c b/gcc/testsuite/gcc.dg/pr17036-1.c new file mode 100644 index 0000000..ea2c9ca --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr17036-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +int main () +{ + int R, N = 4; + unsigned int A = 2; + signed int B = 2; + ((B >> N) & 1) ? 1 : 0; + ((A >> N) & 1) ? 1 : 0; + return 0; +} |