This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgcj/11241] New: WeakHashMap throws a "/ zero" ArithmeticException when initialCapacity is explicitly zero


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 ...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]