diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-10-04 17:49:13 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-10-04 17:49:13 +0200 |
commit | 828fde809c0a0c1e64a411f3db10c02d775a9f3d (patch) | |
tree | 7df63e3198b51ae14cadad518c7a763b15c9c179 /gcc/fold-const.c | |
parent | bed8af19ec83d0e51a37a55faf1a87979a85a9b9 (diff) | |
download | gcc-828fde809c0a0c1e64a411f3db10c02d775a9f3d.zip gcc-828fde809c0a0c1e64a411f3db10c02d775a9f3d.tar.gz gcc-828fde809c0a0c1e64a411f3db10c02d775a9f3d.tar.bz2 |
re PR middle-end/45876 (ICE: verify_gimple failed)
PR middle-end/45876
* fold-const.c (fold_binary_loc) <case BIT_AND_EXPR>: Use
arg0's type or its unsigned counterpart as utype. Convert
arg1 to utype unconditionally.
* gcc.c-torture/compile/pr45876.c: New test.
From-SVN: r164943
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b2dbb98..8146920 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -11152,12 +11152,12 @@ fold_binary_loc (location_t loc, || (TREE_CODE (arg0) != NEGATE_EXPR && pmop[1] != TREE_OPERAND (arg0, 1))) { - tree utype = type; + tree utype = TREE_TYPE (arg0); if (! TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0))) { /* Perform the operations in a type that has defined overflow behavior. */ - utype = unsigned_type_for (type); + utype = unsigned_type_for (TREE_TYPE (arg0)); if (pmop[0] != NULL) pmop[0] = fold_convert_loc (loc, utype, pmop[0]); if (pmop[1] != NULL) @@ -11184,16 +11184,9 @@ fold_binary_loc (location_t loc, tem = fold_build2_loc (loc, MINUS_EXPR, utype, pmop[0], pmop[1]); /* TEM is now the new binary +, - or unary - replacement. */ - if (utype == type) - return fold_build2_loc (loc, BIT_AND_EXPR, type, - tem, arg1); - else - { - tem = fold_build2_loc (loc, BIT_AND_EXPR, utype, tem, - fold_convert_loc (loc, utype, - arg1)); - return fold_convert_loc (loc, type, tem); - } + tem = fold_build2_loc (loc, BIT_AND_EXPR, utype, tem, + fold_convert_loc (loc, utype, arg1)); + return fold_convert_loc (loc, type, tem); } } } |