public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: tromey@redhat.com
Cc: java@gcc.gnu.org
Subject: Re: real_zerop thinks -0 == 0
Date: Tue, 16 Apr 2002 08:58:00 -0000	[thread overview]
Message-ID: <1018972474.4222.1.camel@florijn> (raw)
In-Reply-To: <87r8lf8z0l.fsf@creche.redhat.com>

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

      reply	other threads:[~2002-04-16 15:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-15 18:22 Mark Wielaard
2002-04-16  8:47 ` Tom Tromey
2002-04-16  8:58   ` Mark Wielaard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1018972474.4222.1.camel@florijn \
    --to=mark@klomp.org \
    --cc=java@gcc.gnu.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).