[v1,1/2] gdb/testsuite: enable back gdb.base/bitshift.exp
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
fail
|
Testing failed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
fail
|
Testing failed
|
Commit Message
Since commit cdd4206647d0 ("gdb/testsuite: fix "continue outside of
loop" TCL errors"), all tests in gdb.base/bitshift.exp are skipped due
to an early return after matching the "ada" language.
This patch enables all tests and adds "opencl" to the skip list since
some test cases aren't handled correctly for it.
Also, since commit 303a881f8789 ("Use gdb_gmp for scalar arithmetic"),
0 instead of -1 is returned for signed negative values shifted by a
negative number, which contradicts Go semantics. So, this patch fixes
the semantics and restores the deleted comment.
---
gdb/testsuite/gdb.base/bitshift.exp | 4 ++--
gdb/valarith.c | 11 ++++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
@@ -175,10 +175,10 @@ proc test_shifts {} {
foreach_with_prefix lang $supported_langs {
set skip_langs {
- "unknown" "ada" "modula-2" "pascal" "fortran"
+ "ada" "fortran" "modula-2" "opencl" "pascal" "unknown"
}
if {[lsearch -exact $skip_langs $lang] >= 0} {
- return
+ continue
}
gdb_test_no_output "set language $lang"
@@ -1302,7 +1302,16 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
{
unsigned long nbits;
if (!check_valid_shift_count (op, result_type, type2, v2, nbits))
- v = 0;
+ /* Pretend the too-large shift was decomposed in a
+ number of smaller shifts. An arithmetic signed
+ right shift of a negative number always yields -1
+ with such semantics. This is the right thing to
+ do for Go, and we might as well do it for
+ languages where it is undefined. Also, pretend a
+ shift by a negative number was a shift by the
+ negative number cast to unsigned, which is the
+ same as shifting by a too-large number. */
+ v = (!result_type->is_unsigned () && v1 < 0) ? -1 : 0;
else
v = v1 >> nbits;
}