public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: mark@klomp.org To: gcc-gnats@gcc.gnu.org Subject: libgcj/2357: HashMap does not handle initialCapacity=0 correctly Date: Fri, 23 Mar 2001 04:26:00 -0000 [thread overview] Message-ID: <20010323121731.25071.qmail@sourceware.cygnus.com> (raw) >Number: 2357 >Category: libgcj >Synopsis: HashMap does not handle initialCapacity=0 correctly >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Mar 23 04:26:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: mark@klomp.org >Release: gcc version 3.0 20010323 (prerelease) >Organization: >Environment: >Description: When the initialCapacity of a HashMap is zero then bucket.length will be zero and then you will get a ArithmetichException in the hash() method. import java.util.HashMap; public class HashMapTest { public static void main(String args[]) { HashMap map = new HashMap(0); map.get(new Object()); } } Exception in thread "main" java.lang.ArithmeticException: / by zero at 0x4016836d: _Jv_ThrowSignal (/usr/local/gcc/lib/libgcj.so.1) at 0x40168402: _Jv_ThrowSignal (/usr/local/gcc/lib/libgcj.so.1) at 0x401dc840: java.util.HashMap.hash(java.lang.Object) (/usr/local/gcc/lib/libgcj.so.1) at 0x401dc0a4: java.util.HashMap.get(java.lang.Object) (/usr/local/gcc/lib/libgcj.so.1) at 0x08048a82: HashMapTest.main(java.lang.String[]) (/tmp/HashMapTest.java:6) at 0x4017f0a5: gnu.gcj.runtime.FirstThread.run() (/usr/local/gcc/lib/libgcj.so.1) at 0x40189d92: java.lang.Thread.run_(java.lang.Object) (/usr/local/gcc/lib/libgcj.so.1) at 0x402a2e68: _Jv_ThreadSetPriority(_Jv_Thread_t, int) (/usr/local/gcc/lib/libgcj.so.1) at 0x4045653d: GC_start_routine (/usr/local/gcc/lib/libgcjgc.so.1) at 0x4046fc75: pthread_detach (/lib/libpthread.so.0) at 0x40559eba: __clone (/lib/libc.so.6) >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2001-03-23 4:26 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-03-23 4:26 mark [this message] 2001-03-24 0:16 Bryce McKinlay
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20010323121731.25071.qmail@sourceware.cygnus.com \ --to=mark@klomp.org \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).