This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: RFC: work around mprec problem on x86-64
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: classpath-patches at gnu dot org
- Date: 13 Sep 2005 12:06:09 -0600
- Subject: Patch: RFC: work around mprec problem on x86-64
- Reply-to: tromey at redhat dot com
I want to check this in to Classpath; once the 4.0 branch is unfrozen
I will put it there as well. I thought I'd get some comments about
this since this isn't really my area so much.
This works around a bug with a particular test case. When run on a
non-Pack_32 system (e.g., x86-64), mprec will overflow a buffer and
cause an infinite loop (or presumably other bad things).
We really ought to import a new version of this code that dynamically
allocates its arrays. Meanwhile, upping the size avoided aborts for
me -- at the expense of a lot of space and some uncertainty about
whether there are other failure modes. On x86-64 at least this means
we're allocating more than 16k on the stack during dtoa(); I'm not at
all sure this is a good idea.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
Workaround for PR classpath/23863:
* native/fdlibm/mprec.h (MAX_BIGNUM_WDS): Define as 128 on
non-Pack_32 platforms.
Index: native/fdlibm/mprec.h
===================================================================
RCS file: /cvsroot/classpath/classpath/native/fdlibm/mprec.h,v
retrieving revision 1.4
diff -u -r1.4 mprec.h
--- native/fdlibm/mprec.h 9 Apr 2004 14:04:48 -0000 1.4
+++ native/fdlibm/mprec.h 13 Sep 2005 18:00:42 -0000
@@ -291,7 +291,12 @@
#define MAX_BIGNUMS 16
+#ifdef Pack_32
#define MAX_BIGNUM_WDS 32
+#else
+ /* Note that this is a workaround for */
+#define MAX_BIGNUM_WDS 128
+#endif
struct _Jv_Bigint
{