public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
@ 2002-03-25 22:27 tromey
0 siblings, 0 replies; 7+ messages in thread
From: tromey @ 2002-03-25 22:27 UTC (permalink / raw)
To: adam, gcc-bugs, gcc-prs, java-prs, nobody, tromey
Synopsis: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Mon Mar 25 22:27:53 2002
Responsible-Changed-Why:
I'm handling the PR manipulation.
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Mon Mar 25 22:27:53 2002
State-Changed-Why:
Per checked in the fix and asked me to close the PR.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5812
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
@ 2002-03-05 11:36 Per Bothner
0 siblings, 0 replies; 7+ messages in thread
From: Per Bothner @ 2002-03-05 11:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR java/5812; it has been noted by GNATS.
From: Per Bothner <per@bothner.com>
To: tromey@redhat.com
Cc: adam@medovina.org, gcc-gnats@gcc.gnu.org
Subject: Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
Date: Tue, 05 Mar 2002 11:34:36 -0800
This is a multi-part message in MIME format.
--------------090401000906060607030103
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
With this patch I get the expected output:
eureka<3517>/home/bothner/GNU/linux-gcc/gcc/jc1 Bug.class -o Bug.s -quiet
Bug.java: In class `Bug':
Bug.java: In method `Bug.invoke()':
Bug.java:4: warning: unreachable bytecode from 3 to before 6
Bug.java:7: warning: unreachable bytecode from 10 to before 12
Bug.java:9: warning: unreachable bytecode from 15 to the end of the method
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
--------------090401000906060607030103
Content-Type: text/plain;
name="expr.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="expr.patch"
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.134
diff -u -p -r1.134 expr.c
--- expr.c 2002/02/28 23:27:09 1.134
+++ expr.c 2002/03/05 19:32:15
@@ -48,7 +48,7 @@ static tree pop_value PARAMS ((tree));
static void java_stack_swap PARAMS ((void));
static void java_stack_dup PARAMS ((int, int));
static void build_java_athrow PARAMS ((tree));
-static void build_java_jsr PARAMS ((tree, tree));
+static void build_java_jsr PARAMS ((int, int));
static void build_java_ret PARAMS ((tree));
static void expand_java_multianewarray PARAMS ((tree, int));
static void expand_java_arraystore PARAMS ((tree));
@@ -607,15 +607,18 @@ build_java_athrow (node)
/* Implementation for jsr/ret */
static void
-build_java_jsr (where, ret)
- tree where;
- tree ret;
+build_java_jsr (target_pc, return_pc)
+ int target_pc, return_pc;
{
+ tree where = lookup_label (target_pc);
+ tree ret = lookup_label (return_pc);
tree ret_label = fold (build1 (ADDR_EXPR, return_address_type_node, ret));
push_value (ret_label);
flush_quick_stack ();
emit_jump (label_rtx (where));
expand_label (ret);
+ if (instruction_bits [return_pc] & BCODE_VERIFIED)
+ load_type_state (ret);
}
static void
@@ -2972,13 +2975,8 @@ process_jvm_instruction (PC, byte_ops, l
build_java_ret (find_local_variable (index, ptr_type_node, oldpc)); \
}
-#define JSR(OPERAND_TYPE, OPERAND_VALUE) \
- { \
- tree where = lookup_label (oldpc+OPERAND_VALUE); \
- tree ret = lookup_label (PC); \
- build_java_jsr (where, ret); \
- load_type_state (ret); \
- }
+#define JSR(OPERAND_TYPE, OPERAND_VALUE) \
+ build_java_jsr (oldpc+OPERAND_VALUE, PC);
/* Push a constant onto the stack. */
#define PUSHC(OPERAND_TYPE, OPERAND_VALUE) \
--------------090401000906060607030103--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
@ 2002-03-02 12:16 Adam Dingle
0 siblings, 0 replies; 7+ messages in thread
From: Adam Dingle @ 2002-03-02 12:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR java/5812; it has been noted by GNATS.
From: Adam Dingle <adam@medovina.org>
To: tromey@redhat.com
Cc: gcc-gnats@gcc.gnu.org, Per Bothner <per@bothner.com>
Subject: Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3
compiler
Date: Sat, 02 Mar 2002 12:05:35 -0800
> However, given that Sun's compiler generated this, perhaps they intend
> that we only verify reachable code. In this case, the `return' is not
> reachable since there is no `ret' corresponding to the `jsr'.
I'm pretty sure that Sun verifies only reachable code and believes that this
is what a byte code verifier should do. The description of the bytecode
verification process in section 4.9.2 of the Java Virtual Machine
Specification describes a data-flow analyzer which will ignore unreachable
code; see
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#9801
-adam
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
@ 2002-03-02 11:06 Per Bothner
0 siblings, 0 replies; 7+ messages in thread
From: Per Bothner @ 2002-03-02 11:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR java/5812; it has been noted by GNATS.
From: Per Bothner <per@bothner.com>
To: tromey@redhat.com
Cc: adam@medovina.org, gcc-gnats@gcc.gnu.org
Subject: Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
Date: Sat, 02 Mar 2002 10:56:45 -0800
Tom Tromey wrote:
> It isn't clear to me whether this should verify.
> The `return' at PC=15 is invalid, since the method signature is ()I.
> Ordinarily this would be a verification error.
I agree.
> However, given that Sun's compiler generated this, perhaps they intend
> that we only verify reachable code.
Who knows what the by intended - but we have to live with their bugs.
> Per, what do you think about this?
Gcj already emits an 'unreachable bytecode' warning. I think that
would be enough, once we fix whather is causing gcj to crash. I'll
take a look.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
@ 2002-03-02 10:46 Tom Tromey
0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2002-03-02 10:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR java/5812; it has been noted by GNATS.
From: Tom Tromey <tromey@redhat.com>
To: adam@medovina.org
Cc: gcc-gnats@gcc.gnu.org, Per Bothner <per@bothner.com>
Subject: Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
Date: 02 Mar 2002 12:10:11 -0700
>>>>> "Adam" == Adam Dingle <adam@medovina.org> writes:
Adam> When I compile the class definition below with the Sun JDK 1.3
Adam> compiler and then feed the class file to GCJ 3.0.2, GCJ
Adam> segfaults. I've included the .class file as an attachment.
First, I agree that gcj should not crash. That is a bug.
However, this is unusual bytecode.
Here it is:
0: jsr 12
3: goto 15
6: astore_1
7: jsr 12
10: aload_1
11: athrow
12: astore_2
13: iconst_1
14: ireturn
15: return
It isn't clear to me whether this should verify.
The `return' at PC=15 is invalid, since the method signature is ()I.
Ordinarily this would be a verification error.
However, given that Sun's compiler generated this, perhaps they intend
that we only verify reachable code. In this case, the `return' is not
reachable since there is no `ret' corresponding to the `jsr'.
Per, what do you think about this?
I do think it is bogus that Sun's compiler does this.
For this source we generate the aesthetically pleasing:
0: iconst_1
1: ireturn
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
@ 2002-03-02 10:16 Alexandre Petit-Bianco
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Petit-Bianco @ 2002-03-02 10:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR java/5812; it has been noted by GNATS.
From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: adam@medovina.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
Date: Sat, 2 Mar 2002 10:02:05 -0800 (PST)
adam@medovina.org writes:
> When I compile the class definition below with the Sun JDK 1.3
> compiler and then feed the class file to GCJ 3.0.2, GCJ segfaults.
It's also the case with the current tree and 3.1
./A
^ permalink raw reply [flat|nested] 7+ messages in thread
* java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
@ 2002-03-02 8:56 adam
0 siblings, 0 replies; 7+ messages in thread
From: adam @ 2002-03-02 8:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 5812
>Category: java
>Synopsis: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 02 08:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Adam Dingle
>Release: GNU Java version 3.0.2 20010905 (Red Hat Linux 7.1 3.0.1-3) (i386-redhat-linux)
>Organization:
>Environment:
Red Hat Linux 7.2
>Description:
When I compile the class definition below with the Sun JDK 1.3 compiler and then feed the class file to GCJ 3.0.2, GCJ segfaults. I've included the .class file as an attachment.
public class Bug
{
public int invoke() {
try {
}
finally {
return 1;
}
}
}
>How-To-Repeat:
% gcj3 Bug.class
Bug.java: In class `Bug':
Bug.java: In method `Bug.invoke()':
Bug.java:4: Internal error: Segmentation fault
...
%
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-java; name="Bug.class"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Bug.class"
yv66vgADAC0ADwoAAwAMBwANBwAOAQAGPGluaXQ+AQADKClWAQAEQ29kZQEAD0xpbmVOdW1iZXJU
YWJsZQEABmludm9rZQEAAygpSQEAClNvdXJjZUZpbGUBAAhCdWcuamF2YQwABAAFAQADQnVnAQAQ
amF2YS9sYW5nL09iamVjdAAhAAIAAwAAAAAAAgABAAQABQABAAYAAAAdAAEAAQAAAAUqtwABsQAA
AAEABwAAAAYAAQAAAAEAAQAIAAkAAQAGAAAAOAABAAMAAAAQqAAMpwAMTKgABSu/TQSssQABAAAA
BgAGAAAAAQAHAAAADgADAAAABAAGAAcADwAJAAEACgAAAAIACw==
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-03-26 6:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-25 22:27 java/5812: GCJ 3.0.2 segfaults on class file from Sun JDK 1.3 compiler tromey
-- strict thread matches above, loose matches on Subject: below --
2002-03-05 11:36 Per Bothner
2002-03-02 12:16 Adam Dingle
2002-03-02 11:06 Per Bothner
2002-03-02 10:46 Tom Tromey
2002-03-02 10:16 Alexandre Petit-Bianco
2002-03-02 8:56 adam
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).