From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11563 invoked by alias); 19 Jan 2006 18:13:33 -0000 Received: (qmail 11555 invoked by uid 22791); 19 Jan 2006 18:13:32 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 19 Jan 2006 18:13:28 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k0JIDRBb017070 for ; Thu, 19 Jan 2006 13:13:27 -0500 Received: from opsy.redhat.com (vpn50-124.rdu.redhat.com [172.16.50.124]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k0JIDQ113441; Thu, 19 Jan 2006 13:13:26 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id E35062DC1A0; Thu, 19 Jan 2006 11:09:23 -0700 (MST) To: Java Patch List Subject: [gcjx] Patch: FYI: use canonical NaN values From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom Date: Thu, 19 Jan 2006 18:13:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2006-q1/txt/msg00080.txt.bz2 I'm checking this in on the gcjx branch. The japi run on builder.classpath.org pointed out a buglet in gcjx's class generation code. It wasn't emitting the canonical NaN values into the constant pool. Fixed as appended. Tom Index: ChangeLog from Tom Tromey * bytecode/outpool.cc (add(jdouble)): Use canonical NaN representation. (add(jfloat)): Likewise. Index: bytecode/outpool.cc =================================================================== --- bytecode/outpool.cc (revision 108950) +++ bytecode/outpool.cc (working copy) @@ -1,6 +1,6 @@ // A constant pool being generated. -// Copyright (C) 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -67,7 +67,7 @@ template int outgoing_constant_pool::check_qual (std::map &the_map, - model_type *the_type, T the_value) + model_type *the_type, T the_value) { typename std::map::iterator iter = the_map.find (the_value); @@ -268,7 +268,12 @@ int outgoing_constant_pool::add (jfloat val) { - jint w = float_to_word (val); + // Use Java's canonical NaN value. + jint w; + if (isnan (val)) + w = 0x7fc00000; + else + w = float_to_word (val); int index = check (float_map, w); if (index < 0) { @@ -286,7 +291,16 @@ outgoing_constant_pool::add (jdouble val) { jint words[2]; - double_to_words (words, val); + + // Use Java's canonical NaN value. + if (isnan (val)) + { + words[0] = 0x7ff80000; + words[1] = 0; + } + else + double_to_words (words, val); + // Note that order of words here doesn't matter, since this // representation is for internal use only. jlong lval = words_to_long (words[0], words[1]);