aboutsummaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2001-02-23 21:10:35 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2001-02-23 16:10:35 -0500
commit3cc247a81a4e4ed0abb83a096333671f882d15ff (patch)
tree08fee81497a15c508d229f0af6f7c1ba4ea059d2 /gcc/convert.c
parentac50176d22e5a67355cde8740a2acac344c0e35d (diff)
downloadgcc-3cc247a81a4e4ed0abb83a096333671f882d15ff.zip
gcc-3cc247a81a4e4ed0abb83a096333671f882d15ff.tar.gz
gcc-3cc247a81a4e4ed0abb83a096333671f882d15ff.tar.bz2
convert.c (convert_to_integer): Don't do unsigned unless result or both inputs are unsigned.
* convert.c (convert_to_integer): Don't do unsigned unless result or both inputs are unsigned. From-SVN: r40014
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index dd1b91a..b97d08f 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -310,13 +310,13 @@ convert_to_integer (type, expr)
{
/* Don't do unsigned arithmetic where signed was wanted,
or vice versa.
- Exception: if either of the original operands were
+ Exception: if both of the original operands were
unsigned then can safely do the work as unsigned.
And we may need to do it as unsigned
if we truncate to the original size. */
typex = ((TREE_UNSIGNED (TREE_TYPE (expr))
- || TREE_UNSIGNED (TREE_TYPE (arg0))
- || TREE_UNSIGNED (TREE_TYPE (arg1)))
+ || (TREE_UNSIGNED (TREE_TYPE (arg0))
+ && TREE_UNSIGNED (TREE_TYPE (arg1))))
? unsigned_type (typex) : signed_type (typex));
return convert (type,
fold (build (ex_form, typex,