public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: java/8955: switch case statement causes gcj to throw segmentation fault Date: Wed, 18 Dec 2002 17:36:00 -0000 [thread overview] Message-ID: <20021219013601.12740.qmail@sources.redhat.com> (raw) The following reply was made to PR java/8955; it has been noted by GNATS. From: Tom Tromey <tromey@redhat.com> To: bhun@chello.nl Cc: gcc-gnats@gcc.gnu.org, Gary Benson <gbenson@redhat.com> Subject: Re: java/8955: switch case statement causes gcj to throw segmentation fault Date: 18 Dec 2002 18:34:49 -0700 >>>>> ">" == Dhek Bhun Kho <bhun@chello.nl> writes: >> Number: 8955 >> Synopsis: switch case statement causes gcj to throw segmentation fault Could you try the appended patch? gcj 3.3 crashed on Gary's reduced test case. The appended patch fixes that. Tom Index: ChangeLog from Tom Tromey <tromey@redhat.com> * jcf-write.c (generate_bytecode_insns) [SWITCH_EXPR]: Handle case where minimum case value is Integer.MIN_VALUE. Fixes PR java/8955. Index: jcf-write.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v retrieving revision 1.111 diff -u -r1.111 jcf-write.c --- jcf-write.c 16 Dec 2002 18:22:35 -0000 1.111 +++ jcf-write.c 19 Dec 2002 01:29:59 -0000 @@ -1746,6 +1746,7 @@ else { HOST_WIDE_INT i; + unsigned HOST_WIDE_INT delta; /* Copy the chain of relocs into a sorted array. */ struct jcf_relocation **relocs = (struct jcf_relocation **) xmalloc (sw_state.num_cases * sizeof (struct jcf_relocation *)); @@ -1778,8 +1779,11 @@ handled by the parser. */ } - if (2 * sw_state.num_cases - >= sw_state.max_case - sw_state.min_case) + /* We could have DELTA < 0 if sw_state.min_case is + something like Integer.MIN_VALUE. That is why delta is + unsigned. */ + delta = sw_state.max_case - sw_state.min_case; + if (2 * sw_state.num_cases >= delta) { /* Use tableswitch. */ int index = 0; RESERVE (13 + 4 * (sw_state.max_case - sw_state.min_case + 1));
next reply other threads:[~2002-12-19 1:36 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-12-18 17:36 Tom Tromey [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-12-20 11:29 tromey 2002-12-19 11:35 tromey 2002-12-19 1:56 Gary Benson 2002-12-18 5:26 Gary Benson 2002-12-15 22:06 bhun
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=20021219013601.12740.qmail@sources.redhat.com \ --to=tromey@redhat.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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).