diff options
author | Richard Guenther <rguenther@suse.de> | 2010-07-29 10:59:54 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2010-07-29 10:59:54 +0000 |
commit | c8f0fe4d9d133d4ed520636dbb0b3a40344e29ad (patch) | |
tree | 6a70422b360d8f8cb89bc1cd1f4fee1cfffc246a /gcc/convert.c | |
parent | bbb589f2f2c0d2b18f91a40828121876d74f9cdb (diff) |
2010-07-29 Richard Guenther <rguenther@suse.de>
PR middle-end/45034
* convert.c (convert_to_integer): Always use an unsigned
type for narrowed negate and bitwise not.
* gcc.c-torture/execute/pr45034.c: New testcase.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@162673 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index 48f3f944c71..57eedbf5388 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -799,14 +799,7 @@ convert_to_integer (tree type, tree expr) /* This is not correct for ABS_EXPR, since we must test the sign before truncation. */ { - tree typex; - - /* Don't do unsigned arithmetic where signed was wanted, - or vice versa. */ - if (TYPE_UNSIGNED (TREE_TYPE (expr))) - typex = unsigned_type_for (type); - else - typex = signed_type_for (type); + tree typex = unsigned_type_for (type); return convert (type, fold_build1 (ex_form, typex, convert (typex, |