From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22608 invoked by alias); 16 Apr 2002 15:54:46 -0000 Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org Received: (qmail 22495 invoked from network); 16 Apr 2002 15:54:42 -0000 Received: from unknown (HELO mx0.tryllian.com) (212.0.243.3) by sources.redhat.com with SMTP; 16 Apr 2002 15:54:42 -0000 Received: (qmail 4933 invoked from network); 16 Apr 2002 15:54:29 -0000 Received: from unknown (HELO florijn.intra.tryllian.net) (212.0.243.10) by outcast.tryllian.com with SMTP; 16 Apr 2002 15:54:29 -0000 Subject: Re: real_zerop thinks -0 == 0 From: Mark Wielaard To: tromey@redhat.com Cc: java@gcc.gnu.org In-Reply-To: <87r8lf8z0l.fsf@creche.redhat.com> References: <1018914537.30925.36.camel@elsschot> <87r8lf8z0l.fsf@creche.redhat.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 16 Apr 2002 08:58:00 -0000 Message-Id: <1018972474.4222.1.camel@florijn> Mime-Version: 1.0 X-Message: scanned for viruses by AMaViS X-SW-Source: 2002-04/txt/msg00242.txt.bz2 On Tue, 2002-04-16 at 17:05, Tom Tromey wrote: > >>>>> "Mark" == Mark Wielaard 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