From 69de014b773a5e99e8fc776a9365031f4a796c67 Mon Sep 17 00:00:00 2001 From: schwab Date: Thu, 11 Aug 2005 13:45:37 +0000 Subject: [PATCH] PR exp/1978 * valarith.c (value_binop): Fix result type for the shift operators. --- gdb/ChangeLog | 6 ++++++ gdb/valarith.c | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b5d805d101..637919add0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2005-08-11 Andreas Schwab + + PR exp/1978 + * valarith.c (value_binop): Fix result type for the shift + operators. + 2005-08-09 Mark Kettenis * sparc64obsd-tdep.c: Tweak comments. diff --git a/gdb/valarith.c b/gdb/valarith.c index ef03fb9839..2e1471c3bc 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; -- 2.11.0