This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcj/11241] New: WeakHashMap throws a "/ zero" ArithmeticException when initialCapacity is explicitly zero
- From: "mikeb at lshift dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jun 2003 15:33:48 -0000
- Subject: [Bug libgcj/11241] New: WeakHashMap throws a "/ zero" ArithmeticException when initialCapacity is explicitly zero
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11241
Summary: WeakHashMap throws a "/ zero" ArithmeticException when
initialCapacity is explicitly zero
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: libgcj
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mikeb@lshift.net
CC: gcc-bugs@gcc.gnu.org
When a java.util.WeakHashMap is constructed with the initial capacity explicitly
zero, using get() can throw a "/ zero" java.lang.ArithmeticException. The
problem is in the private hash function, which uses "x % buckets.length". In
the case of an initial capacity of zero, buckets.length is zero.
I've fixed that immediate problem (test cases and patch coming RSN). There
appear to be some other problems with WeakHashMap in the same circumstances
though. I'll work through those now ...