From 0d059fcaa4840fdd24f0664318dc3d36218242e1 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 11 Aug 2005 13:45:40 +0000 Subject: PR exp/1978 * valarith.c (value_binop): Fix result type for the shift operators. --- gdb/valarith.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gdb/valarith.c') diff --git a/gdb/valarith.c b/gdb/valarith.c index ef03fb9..2e1471c 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -883,7 +883,14 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) Use the signedness of the operand with the greater length. If both operands are of equal length, use unsigned operation if one of the operands is unsigned. */ - if (promoted_len1 > promoted_len2) + if (op == BINOP_RSH || op == BINOP_LSH) + { + /* In case of the shift operators the type of the result only + depends on the type of the left operand. */ + unsigned_operation = is_unsigned1; + result_len = promoted_len1; + } + else if (promoted_len1 > promoted_len2) { unsigned_operation = is_unsigned1; result_len = promoted_len1; -- cgit v1.1