aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2001-05-25 00:01:29 +0000
committerJim Blandy <jimb@codesourcery.com>2001-05-25 00:01:29 +0000
commit400071f14b469889399c792d701dc122d1f3d5cc (patch)
treef60085e98561db490cfeddf9e5b2beb0ba46def5 /gdb/testsuite
parentb58c9faf2fef1746403a4e4734654dd8a57fad82 (diff)
downloadgdb-400071f14b469889399c792d701dc122d1f3d5cc.zip
gdb-400071f14b469889399c792d701dc122d1f3d5cc.tar.gz
gdb-400071f14b469889399c792d701dc122d1f3d5cc.tar.bz2
Don't assume that short is shorter than int.
* gdb.base/exprs.exp ("print unsigned short == (~0)"): Don't assume that shorts are smaller than ints. On a 16-bit machine, this isn't true. ("print unsigned char == (~0)"): Add test that verifies that ~0, an int, is not equal to ~0 stored in an unsigned char. This tests the same thing that the previous test meant to, but works on 16-bit machines, too. ("print unsigned char != (~0)"): Same test, complemented.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog12
-rw-r--r--gdb/testsuite/gdb.base/exprs.exp6
2 files changed, 15 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 58da1b5..fd41d1f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2001-05-24 Jim Blandy <jimb@redhat.com>
+
+ Don't assume that short is shorter than int.
+ * gdb.base/exprs.exp ("print unsigned short == (~0)"): Don't
+ assume that shorts are smaller than ints. On a 16-bit machine,
+ this isn't true.
+ ("print unsigned char == (~0)"): Add test that verifies that ~0,
+ an int, is not equal to ~0 stored in an unsigned char. This tests
+ the same thing that the previous test meant to, but works on
+ 16-bit machines, too.
+ ("print unsigned char != (~0)"): Same test, complemented.
+
2001-05-24 Michael Snyder <msnyder@redhat.com>
* gdb.threads/pthreads.exp (all_threads_running): Add an explicit
diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index 1bffd0a..d1eb087 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -101,11 +101,11 @@ test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0
# FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've
# set up an expected failure for this case.
setup_xfail "i960-*-*" 1821
-test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false" "print v_unsigned_char == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = $true" "print unsigned char == (~0)"
+test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false" "print v_unsigned_char == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = $true" "print v_unsigned_char == ~0" "\\$\[0-9\]* = $false" "print unsigned char == (~0)"
# FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've
# set up an expected failure for this case.
setup_xfail "i960-*-*" 1821
-test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true" "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = $false" "print unsigned char != (~0)"
+test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true" "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = $false" "print v_unsigned_char != ~0" "\\$\[0-9\]* = $true" "print unsigned char != (~0)"
test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false" "print v_unsigned_char < 127" "\\$\[0-9\]* = $false" "print unsigned char < (~0)"
test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true" "print v_unsigned_char > 127" "\\$\[0-9\]* = $true" "print unsigned char > (~0)"
#
@@ -140,7 +140,7 @@ test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "
test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short <"
test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short >"
# make short a minus
-test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false" "print v_unsigned_short == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = $true" "print unsigned short == (~0)"
+test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false" "print sizeof (v_unsigned_short) < sizeof (~0) && v_unsigned_short == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = $true" "print unsigned short == (~0)"
test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = $true" "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = $false" "print unsigned short != (~0)"
test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short < (~0)"
test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned short > (~0)"