aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2004-08-16 13:03:51 +0000
committerAndrew Haley <aph@gcc.gnu.org>2004-08-16 13:03:51 +0000
commita20f4d83c8ec7fb99c8532a84db5204fe00cf71d (patch)
tree6eec27556d5261ee7e2dfb3a7b78ae656b9db359 /gcc
parentf699e4541433ca9c8af8a4cad64d7a859b9fc782 (diff)
downloadgcc-a20f4d83c8ec7fb99c8532a84db5204fe00cf71d.zip
gcc-a20f4d83c8ec7fb99c8532a84db5204fe00cf71d.tar.gz
gcc-a20f4d83c8ec7fb99c8532a84db5204fe00cf71d.tar.bz2
jcf-write.c (find_constant_index): Canonicalize NaNs when generating bytecode.
2004-08-16 Andrew Haley <aph@redhat.com> * jcf-write.c (find_constant_index): Canonicalize NaNs when generating bytecode. From-SVN: r86053
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/jcf-write.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 4e0dc7e..761c886 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-16 Andrew Haley <aph@redhat.com>
+
+ * jcf-write.c (find_constant_index): Canonicalize NaNs when
+ generating bytecode.
+
2004-08-16 Elliot Lee <sopwith@redhat.com>
PR java/9677
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index d775a81..7b5bdcc 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -798,6 +798,19 @@ find_constant_index (tree value, struct jcf_partial *state)
{
long words[2];
+ /* IEEE NaN can have many values, but the Java VM spec defines a
+ canonical NaN. */
+ if (flag_emit_class_files
+ && REAL_VALUE_ISNAN (TREE_REAL_CST (value)))
+ {
+ if (TYPE_PRECISION (TREE_TYPE (value)) == 32)
+ return find_constant1 (&state->cpool, CONSTANT_Float,
+ 0x7fc00000);
+ else
+ return find_constant2 (&state->cpool, CONSTANT_Double,
+ 0x7ff80000, 0x00000000);
+ }
+
real_to_target (words, &TREE_REAL_CST (value),
TYPE_MODE (TREE_TYPE (value)));
words[0] &= 0xffffffff;