From 95016fd211b66445cb3b9e86aeb8b6951f56315f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 10 Nov 2020 10:06:08 -0700 Subject: [PATCH] Fix bug in gdb.ada/bias.exp While working on a different bug in the Ada support, I found that the gdb.ada/bias.exp test is slightly incorrect. In particular, it is using a range type, which it then overflows during an operation. This patch changes the test so that the computed values remain in range. gdb/testsuite/ChangeLog 2020-11-10 Tom Tromey * gdb.ada/bias.exp: Update. * gdb.ada/bias/bias.adb (X): Change value. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.ada/bias.exp | 10 +++++----- gdb/testsuite/gdb.ada/bias/bias.adb | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 608e48d8603..18c3988b210 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-11-10 Tom Tromey + + * gdb.ada/bias.exp: Update. + * gdb.ada/bias/bias.adb (X): Change value. + 2020-11-10 Gary Benson * gdb.base/vla-optimized-out.exp (p sizeof (a)): Wrap supplied diff --git a/gdb/testsuite/gdb.ada/bias.exp b/gdb/testsuite/gdb.ada/bias.exp index c7a78505c46..dfa897fe151 100644 --- a/gdb/testsuite/gdb.ada/bias.exp +++ b/gdb/testsuite/gdb.ada/bias.exp @@ -29,7 +29,7 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "STOP" ${testdir}/bias.adb] runto "bias.adb:$bp_location" -gdb_test "print x" " = 64" +gdb_test "print x" " = 60" gdb_test "print y" " = -5" gdb_test "print cval" " = 65" @@ -44,11 +44,11 @@ gdb_test "print y = y" " = true" gdb_test "print y /= y" " = false" gdb_test "print y /= y1" " = true" -gdb_test "print x + x1" " = 65" +gdb_test "print x + x1" " = 61" gdb_test "ptype x + x1" "type = range 1 \\.\\. 64" -gdb_test "print x / x1" " = 64" -gdb_test "print x * x1" " = 64" -gdb_test "print x - x1" " = 63" +gdb_test "print x / x1" " = 60" +gdb_test "print x * x1" " = 60" +gdb_test "print x - x1" " = 59" # Test that storing un-biases. gdb_test "print x := 5" " = 5" diff --git a/gdb/testsuite/gdb.ada/bias/bias.adb b/gdb/testsuite/gdb.ada/bias/bias.adb index abea17002f1..cf24810f53a 100644 --- a/gdb/testsuite/gdb.ada/bias/bias.adb +++ b/gdb/testsuite/gdb.ada/bias/bias.adb @@ -23,7 +23,7 @@ procedure Bias is type Repeat_Count_T is range 1 .. 2 ** 6; for Repeat_Count_T'Size use 6; - X : Repeat_Count_T := 64; + X : Repeat_Count_T := 60; X1 : Repeat_Count_T := 1; type Char_Range is range 65 .. 68; -- 2.30.2