aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2005-08-21 09:33:11 +0000
committerMark Kettenis <kettenis@gnu.org>2005-08-21 09:33:11 +0000
commitd067a990c866d3fe08d3f6209cc5d78e91e5e56f (patch)
tree174868573fb7fea20b28ade1fd79ab9a3311a1a8
parente764ed5ba944173f68da088e314e292a21ea51c2 (diff)
downloadgdb-d067a990c866d3fe08d3f6209cc5d78e91e5e56f.zip
gdb-d067a990c866d3fe08d3f6209cc5d78e91e5e56f.tar.gz
gdb-d067a990c866d3fe08d3f6209cc5d78e91e5e56f.tar.bz2
* valarith.c (value_equal, value_less): Avoid compiler bug on
systems where `long double' values are returned in static storage.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/valarith.c18
2 files changed, 19 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4028cd8..4665207 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-21 Mark Kettenis <kettenis@gnu.org>
+
+ * valarith.c (value_equal, value_less): Avoid compiler bug on
+ systems where `long double' values are returned in static storage.
+
2005-08-18 Mark Kettenis <kettenis@gnu.org>
* stack.c: Reformat. Improve comments. Include "valprint.h".
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 2e1471c..c2a55e8 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1,8 +1,8 @@
/* Perform arithmetic and other operations on values, for GDB.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
- Software Foundation, Inc.
+ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -1248,7 +1248,12 @@ value_equal (struct value *arg1, struct value *arg2)
BINOP_EQUAL)));
else if ((code1 == TYPE_CODE_FLT || is_int1)
&& (code2 == TYPE_CODE_FLT || is_int2))
- return value_as_double (arg1) == value_as_double (arg2);
+ {
+ /* NOTE: kettenis/20050816: Avoid compiler bug on systems where
+ `long double' values are returned in static storage (m68k). */
+ DOUBLEST d = value_as_double (arg1);
+ return d == value_as_double (arg2);
+ }
/* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
is bigger. */
@@ -1307,7 +1312,12 @@ value_less (struct value *arg1, struct value *arg2)
BINOP_LESS)));
else if ((code1 == TYPE_CODE_FLT || is_int1)
&& (code2 == TYPE_CODE_FLT || is_int2))
- return value_as_double (arg1) < value_as_double (arg2);
+ {
+ /* NOTE: kettenis/20050816: Avoid compiler bug on systems where
+ `long double' values are returned in static storage (m68k). */
+ DOUBLEST d = value_as_double (arg1);
+ return d < value_as_double (arg2);
+ }
else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
return value_as_address (arg1) < value_as_address (arg2);