summaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2005-08-11 13:45:40 +0000
committerAndreas Schwab <schwab@suse.de>2005-08-11 13:45:40 +0000
commit6b6e29e3f18fdf8c97dabe24426f449bcbe9c5ae (patch)
tree2739e2a805de1cbcbcfcc2cab31dfd8ffe56efd5 /gdb/valarith.c
parent1e00df3c7bba5768658d3e4c11312759b11951eb (diff)
downloadgdb-6b6e29e3f18fdf8c97dabe24426f449bcbe9c5ae.tar.gz
PR exp/1978
* valarith.c (value_binop): Fix result type for the shift operators.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index ef03fb9839c..2e1471c3bc4 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;