public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: adam@medovina.org To: gcc-gnats@gcc.gnu.org Subject: java/5794: gcj fails to verify .class file generated by Sun JDK 1.4 compiler Date: Thu, 28 Feb 2002 12:56:00 -0000 [thread overview] Message-ID: <20020228200848.5674.qmail@sources.redhat.com> (raw) >Number: 5794 >Category: java >Synopsis: gcj fails to verify .class file generated by Sun JDK 1.4 compiler >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Thu Feb 28 12:15:59 PST 2002 >Closed-Date: >Last-Modified: >Originator: Adam Dingle >Release: gcc version 3.0.2 20010905 (Red Hat Linux 7.1 3.0.1-3) >Organization: >Environment: Red Hat Linux 7.2 on a Pentium PC >Description: If I use Sun's Java compiler (from JDK 1.4) to compile a .java file containing a try...finally block, then try to use gcj to compile the .class file into executable code, gcj complains with the error message "bad pc in exception_table". Here's what's going on. Recall that a Java .class file contains an exception table for each method. Each entry in the exception table contains a range (from, to) of instructions to protect as well as a target instruction to jump to if an exception occurs within that range. When Sun's Java compiler in JDK 1.4 compiles a try...finally block, it emits a (useless and unused) exception table entry whose target is within the range of protected instructions. There is nothing inherently unsafe with this, but we check for this case and reject it in verify.c. Unfortunately, the fix is apparently not as simple as removing the line which makes this check (the line "|| (handler_pc >= start_pc && handler_pc < end_pc)" in verify_jvm_instructions() in verify.c); I tried that and then gcj complained about a stack overflow in the same .class file. I don't have time to look at the verification code more right now, so I'm filing a bug report in case someone else wants to pick up where I left off. >How-To-Repeat: $ /usr/java/j2sdk1.4.0/bin/javac Foo.java $ gcj Foo.class Foo.java: In class `Foo': Foo.java: In method `Foo.invoke()': Foo.java:6: bad pc in exception_table $ >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-java; name="Foo.java" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Foo.java" cHVibGljIGNsYXNzIEZvbwp7CglwdWJsaWMgaW50IGludm9rZSgpCgl7CgkJdHJ5IHsKCQkJcmV0 dXJuIDE7CgkJfSAgZmluYWxseSB7CgkJCXJldHVybiAyOwoJCX0KCX0KfQo=
next reply other threads:[~2002-02-28 20:16 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-02-28 12:56 adam [this message] 2002-02-28 22:56 Tom Tromey 2002-03-01 0:06 Adam Dingle 2002-03-02 9:26 Adam Dingle 2002-03-02 10:36 Tom Tromey 2002-03-02 10:46 Adam Dingle 2002-03-02 17:16 Tom Tromey 2002-09-11 12:41 tromey
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=20020228200848.5674.qmail@sources.redhat.com \ --to=adam@medovina.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).