* real_zerop thinks -0 == 0
@ 2002-04-15 18:22 Mark Wielaard
2002-04-16 8:47 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2002-04-15 18:22 UTC (permalink / raw)
To: java
Hi,
The following seems to fix a couple of the remaining Mauve failures (the
mauve tests are first compiled to byte-code).
--- jcf-write.c 12 Mar 2002 10:33:57 -0000 1.99.2.1
+++ jcf-write.c 15 Apr 2002 23:37:46 -0000
@@ -1536,9 +1536,7 @@
{
int prec = TYPE_PRECISION (type) >> 5;
RESERVE(1);
- if (real_zerop (exp))
- OP1 (prec == 1 ? OPCODE_fconst_0 : OPCODE_dconst_0);
- else if (real_onep (exp))
+ if (real_onep (exp))
OP1 (prec == 1 ? OPCODE_fconst_1 : OPCODE_dconst_1);
/* FIXME Should also use fconst_2 for 2.0f.
Also, should use iconst_2/ldc followed by i2f/i2d
This isn't a real solution, but I don't know how to correctly test for
positive zero and I really must get some sleep now. Maybe someone more
familiar with this code can suggest the proper solution.
The example code to try is:
public class Z
{
public static void main(String[] args)
{
System.out.println(-0.0f);
}
}
Compile with gcj -C and run with gij. Output should be -0.0.
Good night,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: real_zerop thinks -0 == 0
2002-04-15 18:22 real_zerop thinks -0 == 0 Mark Wielaard
@ 2002-04-16 8:47 ` Tom Tromey
2002-04-16 8:58 ` Mark Wielaard
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2002-04-16 8:47 UTC (permalink / raw)
To: Mark Wielaard; +Cc: java
>>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
Mark> - if (real_zerop (exp))
Mark> - OP1 (prec == 1 ? OPCODE_fconst_0 : OPCODE_dconst_0);
Mark> - else if (real_onep (exp))
Mark> + if (real_onep (exp))
Mark> This isn't a real solution, but I don't know how to correctly
Mark> test for positive zero and I really must get some sleep
Mark> now. Maybe someone more familiar with this code can suggest the
Mark> proper solution.
I don't know if it is the proper solution but in gcc/real.h I see
REAL_VALUE_MINUS_ZERO. Would it be appropriate to use this?
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: real_zerop thinks -0 == 0
2002-04-16 8:47 ` Tom Tromey
@ 2002-04-16 8:58 ` Mark Wielaard
0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2002-04-16 8:58 UTC (permalink / raw)
To: tromey; +Cc: java
On Tue, 2002-04-16 at 17:05, Tom Tromey wrote:
> >>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
>
> Mark> - if (real_zerop (exp))
> Mark> - OP1 (prec == 1 ? OPCODE_fconst_0 : OPCODE_dconst_0);
> Mark> - else if (real_onep (exp))
> Mark> + if (real_onep (exp))
>
> Mark> This isn't a real solution, but I don't know how to correctly
> Mark> test for positive zero and I really must get some sleep
> Mark> now. Maybe someone more familiar with this code can suggest the
> Mark> proper solution.
>
> I don't know if it is the proper solution but in gcc/real.h I see
> REAL_VALUE_MINUS_ZERO. Would it be appropriate to use this?
I am now testing this patch which seems to do exactly what is needed.
--- gcc/java/jcf-write.c 12 Mar 2002 10:33:57 -0000 1.99.2.1
+++ gcc/java/jcf-write.c 16 Apr 2002 15:53:27 -0000
@@ -25,6 +25,7 @@
#include "system.h"
#include "jcf.h"
#include "tree.h"
+#include "real.h"
#include "java-tree.h"
#include "obstack.h"
#undef AND
@@ -1536,7 +1537,7 @@
{
int prec = TYPE_PRECISION (type) >> 5;
RESERVE(1);
- if (real_zerop (exp))
+ if (real_zerop (exp) && ! REAL_VALUE_MINUS_ZERO (TREE_REAL_CST (exp)))
OP1 (prec == 1 ? OPCODE_fconst_0 : OPCODE_dconst_0);
else if (real_onep (exp))
OP1 (prec == 1 ? OPCODE_fconst_1 : OPCODE_dconst_1);
Cheers,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-16 15:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-15 18:22 real_zerop thinks -0 == 0 Mark Wielaard
2002-04-16 8:47 ` Tom Tromey
2002-04-16 8:58 ` Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).