java/1435: gcj segfaults in jc1 on OK java file
ashe@qms.com
ashe@qms.com
Wed Dec 20 12:26:00 GMT 2000
>Number: 1435
>Category: java
>Synopsis: jc1 segfaults on assignment combined with method call or field access
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 20 12:19:50 PST 2000
>Closed-Date: Thu Oct 21 23:16:31 PDT 1999
>Last-Modified: Thu Oct 21 23:20:00 PDT 1999
>Originator: Steven Ashe
>Release: gcj-2.95.1
>Organization:
>Environment:
rh linux 6.0 with gcc 2.95-1 and gdb 4.18
>Description:
The attached reduced-case test file causes a segfault
from jc1: (Can't get it much shorter...)
public final class Foo {
public static void main(String[] args) {
Object o = args;
int[] a;
if (!(o instanceof int[]) || (a = (int[])o).length != 2) {
}
}
}
>How-To-Repeat:
see above
also see my message below for additional test code -BM
>Fix:
>Release-Note:
>Audit-Trail:
Formerly PR gcj/56
From: Tom Tromey <tromey@cygnus.com>
To: Java Gnats Server <java-gnats@sourceware.cygnus.com>
Cc: ashe@qms.com
Subject: gcj/56
Date: Fri, 1 Oct 1999 17:37:55 -0700
I'm adding the code from this PR to the libjava test suite.
T
From: Bryce McKinlay <bryce@albatross.co.nz>
To: ashe@qms.com
Cc: java-gnats@sourceware.cygnus.com,
Alexandre Petit-Bianco <apbianco@cygnus.com>
Subject: Re: gcj/56: gcj segfaults in jc1 on OK java file
Date: Thu, 21 Oct 1999 15:49:41 +1300
ashe@qms.com wrote:
> The attached reduced-case test file causes a segfault
> from jc1: (Can't get it much shorter...)
>
> public final class Foo {
> public static void main(String[] args) {
> Object o = args;
> int[] a;
> if (!(o instanceof int[]) || (a = (int[])o).length != 2) {
> }
> }
> }
I took a quick look at this. I *can* get it shorter (or at least simpler) - the
parser chokes when it encounters an assignment combined with method calls or
field accesses.
public class A
{
public int someint = 5;
}
public class Bar
{
public void bar ()
{
A a;
A b = new A();
int c;
c = (a = b).someint;
}
}
regards
[ bryce ]
From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: Bryce McKinlay <bryce@albatross.co.nz>
Cc: ashe@qms.com, java-gnats@sourceware.cygnus.com,
Alexandre Petit-Bianco <apbianco@cygnus.com>
Subject: Re: gcj/56: gcj segfaults in jc1 on OK java file
Date: Wed, 20 Oct 1999 20:07:48 -0700 (PDT)
Bryce McKinlay writes:
> I took a quick look at this. I *can* get it shorter (or at least
> simpler) - the parser chokes when it encounters an assignment
> combined with method calls or field accesses.
Indeed, I realized that as I was breaking the ||. I also have a patch
for it. I'm testing the regressions now. I'll keep you posted.
./A
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Thu Oct 21 03:59:11 1999
State-Changed-Why:
Here's a patch you should try. Let me know how it works for
you. I'm still testing the non regressions, and I will
refine the patch.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.112
diff -u -p -r1.112 parse.y
--- parse.y 1999/10/14 17:13:56 1.112
+++ parse.y 1999/10/21 10:49:31
@@ -7866,6 +7866,10 @@ qualify_ambiguous_name (id)
TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
+ else if (code == MODIFY_EXPR &&
+ TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
+ name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
+
else if (code == STRING_CST || code == CONDITIONAL_EXPR)
{
qual = TREE_CHAIN (qual);
From: apbianco@cygnus.com
To: apbianco@cygnus.com, ashe@qms.com, java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/56
Date: 21 Oct 1999 10:59:11 -0000
Synopsis: jc1 segfaults on assignment combined with method call or field access
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Thu Oct 21 03:59:11 1999
State-Changed-Why:
Here's a patch you should try. Let me know how it works for
you. I'm still testing the non regressions, and I will
refine the patch.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.112
diff -u -p -r1.112 parse.y
--- parse.y 1999/10/14 17:13:56 1.112
+++ parse.y 1999/10/21 10:49:31
@@ -7866,6 +7866,10 @@ qualify_ambiguous_name (id)
TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
+ else if (code == MODIFY_EXPR &&
+ TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
+ name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
+
else if (code == STRING_CST || code == CONDITIONAL_EXPR)
{
qual = TREE_CHAIN (qual);
http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=56
From: Bryce McKinlay <bryce@albatross.co.nz>
To: apbianco@cygnus.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/56
Date: Fri, 22 Oct 1999 12:07:55 +1300
apbianco@cygnus.com wrote:
> Synopsis: jc1 segfaults on assignment combined with method call or field access
>
> State-Changed-From-To: open->feedback
> State-Changed-By: apbianco
> State-Changed-When: Thu Oct 21 03:59:11 1999
> State-Changed-Why:
> Here's a patch you should try. Let me know how it works for
> you. I'm still testing the non regressions, and I will
> refine the patch.
This patch doesn't work for me. jc1 no longer segfaults, but an error is
incorrectly reported for my test case:
Bar.java: In class `Bar':
Bar.java: In method `bar()':
Bar.java:9: Variable `a' may not have been initialized.
c = (a = b).someint;
^
1 error
regards
[ bryce ]
From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/56
Date: Thu, 21 Oct 1999 22:17:21 -0700
Bryce McKinlay writes:
> This patch doesn't work for me. jc1 no longer segfaults, but an
> error is incorrectly reported for my test case:
> Bar.java: In class `Bar':
> Bar.java: In method `bar()':
> Bar.java:9: Variable `a' may not have been initialized.
> c = (a = b).someint;
> ^
> 1 error
Yes, I overlooked the compilation output. Try this patch.
./A
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.112
diff -u -p -r1.112 parse.y
--- parse.y 1999/10/14 17:13:56 1.112
+++ parse.y 1999/10/22 04:24:47
@@ -6675,6 +6676,7 @@ resolve_qualified_expression_name (wfl,
case CONDITIONAL_EXPR:
case STRING_CST:
+ case MODIFY_EXPR:
*where_found = decl = java_complete_tree (qual_wfl);
if (decl == error_mark_node)
return 1;
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Thu Oct 21 23:16:31 1999
State-Changed-Why:
I just checked in this patch: http://egcs.cygnus.com/ml/gcc-patches/1999-10/msg00582.html
From: apbianco@cygnus.com
To: apbianco@cygnus.com, ashe@qms.com, java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/56
Date: 22 Oct 1999 06:16:31 -0000
Synopsis: jc1 segfaults on assignment combined with method call or field access
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Thu Oct 21 23:16:31 1999
State-Changed-Why:
I just checked in this patch: http://egcs.cygnus.com/ml/gcc-patches/1999-10/msg00582.html
http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=56
>Unformatted:
More information about the Gcc-prs
mailing list