aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2001-06-07 03:42:41 +0000
committerJim Blandy <jimb@codesourcery.com>2001-06-07 03:42:41 +0000
commitfd661517de527122a7d6e36adf474616c7896831 (patch)
treef6f1f9f3e93d074c5ddc05c698c171a834e9d9dc /gdb
parenta90335ee821578fe00a727de873d5b2764dc3443 (diff)
downloadgdb-fd661517de527122a7d6e36adf474616c7896831.zip
gdb-fd661517de527122a7d6e36adf474616c7896831.tar.gz
gdb-fd661517de527122a7d6e36adf474616c7896831.tar.bz2
* gdb.base/return2.exp (main): Use values to test float and double
returns that are not NaN's, to avoid being confused by IEEE comparison rules.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.base/return2.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/return2.c b/gdb/testsuite/gdb.base/return2.c
index cddbb97..58d85ec 100644
--- a/gdb/testsuite/gdb.base/return2.c
+++ b/gdb/testsuite/gdb.base/return2.c
@@ -84,8 +84,27 @@ int main (int argc, char **argv)
int_resultval = int_func (); /* short_checkpoint */
long_resultval = long_func (); /* int_checkpoint */
long_long_resultval = long_long_func (); /* long_checkpoint */
- float_resultval = float_func (); /* long_long_checkpoint */
- double_resultval = double_func (); /* float_checkpoint */
+
+ /* On machines using IEEE floating point, the test pattern of all
+ 1-bits established above turns out to be a floating-point NaN
+ ("Not a Number"). According to the IEEE rules, NaN's aren't even
+ equal to themselves. This can lead to stupid conversations with
+ GDB like:
+
+ (gdb) p testval.float_testval == testval.float_testval
+ $7 = 0
+ (gdb)
+
+ This is the correct answer, but it's not the sort of thing
+ return2.exp wants to see. So to make things work the way they
+ ought, we'll set aside the `union' cleverness and initialize the
+ test values explicitly here. These values have interesting bits
+ throughout the value, so we'll still detect truncated values. */
+
+ testval.float_testval = 2.7182818284590452354;/* long_long_checkpoint */
+ float_resultval = float_func ();
+ testval.double_testval = 3.14159265358979323846; /* float_checkpoint */
+ double_resultval = double_func ();
main_test = 1; /* double_checkpoint */
return 0;
}