public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/1368: Static array initializer link failure with -O
@ 2000-12-20 12:25 bryce
0 siblings, 0 replies; only message in thread
From: bryce @ 2000-12-20 12:25 UTC (permalink / raw)
To: java-gnats
>Number: 1368
>Category: java
>Synopsis: Static array initializer link failure with -O
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 20 12:19:19 PST 2000
>Closed-Date: Fri Oct 13 14:12:58 PDT 2000
>Last-Modified: Wed Oct 18 04:16:01 PDT 2000
>Originator: Bryce McKinlay
>Release: gcc version 2.96 20000905 (experimental)
>Organization:
>Environment:
>Description:
Static arrays with initializers fail to link when optimization
is used. This is a recent regression.
$ gcj ArrayInit.java -o ai --main=ArrayInit -O
/tmp/ccmJthip.o: In function `ArrayInit::_003cclinit_003e(unsigned)':
/tmp/ccmJthip.o(.text+0x99): undefined reference to `LJv0'
collect2: ld returned 1 exit status
>How-To-Repeat:
Compile this test case:
public class ArrayInit
{
static int a[] = {1,2,3};
public static void main(String args[])
{
System.out.println (a[0]);
}
}
>Fix:
>Release-Note:
>Audit-Trail:
Formerly PR gcj/340
From: Bryce McKinlay <bryce@albatross.co.nz>
To: java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/340: Static array initializer link failure with -O
Date: Mon, 09 Oct 2000 14:30:26 +1300
bryce@albatross.co.nz wrote:
> $ gcj ArrayInit.java -o ai --main=ArrayInit -O
> /tmp/ccmJthip.o: In function `ArrayInit::_003cclinit_003e(unsigned)':
> /tmp/ccmJthip.o(.text+0x99): undefined reference to `LJv0'
> collect2: ld returned 1 exit status
This bug is still present in the current compiler.
Here is my workaround:
Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/expr.c,v
retrieving revision 1.87
diff -u -r1.87 expr.c
--- expr.c 2000/10/05 07:17:34 1.87
+++ expr.c 2000/10/09 01:27:02
@@ -2328,6 +2328,7 @@
tree init = TREE_OPERAND (exp, 0);
tree array_decl;
+#if 0
/* See if we can generate the array statically. */
if (TREE_CONSTANT (init) && TREE_STATIC (exp)
&& JPRIMITIVE_TYPE_P (element_type))
@@ -2361,6 +2362,7 @@
pop_obstacks ();
return r;
}
+#endif
array_decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp));
expand_decl (array_decl);
[ bryce ]
From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/340: Static array initializer link failure with -O
Date: Tue, 10 Oct 2000 13:44:06 -0700 (PDT)
Bryce McKinlay writes:
> Here is my workaround:
AG already checked something in in August a year ago. And it
disappeared, most likely during a merge.
./A
2000-10-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
* java_lang_expand_expr: Reinstall 1999-08-14 Anthony's
patch. Fixed gcj/340.
Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/expr.c,v
retrieving revision 1.87
diff -u -p -r1.87 expr.c
--- expr.c 2000/10/05 07:17:34 1.87
+++ expr.c 2000/10/10 20:24:08
@@ -2355,6 +2355,7 @@ java_lang_expand_expr (exp, target, tmod
DECL_INITIAL (init_decl) = value;
DECL_IGNORED_P (init_decl) = 1;
TREE_READONLY (init_decl) = 1;
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
make_decl_rtl (init_decl, NULL, 1);
init = build1 (ADDR_EXPR, TREE_TYPE (exp), init_decl);
r = expand_expr (init, target, tmode, modifier);
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Tue Oct 10 13:56:27 2000
State-Changed-Why:
There was a patch:
http://sources.redhat.com/ml/java-prs/2000-q4/msg00023.html
From: apbianco@cygnus.com
To: apbianco@cygnus.com, bryce@albatross.co.nz,
java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/340
Date: 10 Oct 2000 20:56:27 -0000
Synopsis: Static array initializer link failure with -O
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Tue Oct 10 13:56:27 2000
State-Changed-Why:
There was a patch:
http://sources.redhat.com/ml/java-prs/2000-q4/msg00023.html
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=340&database=java
From: Bryce McKinlay <bryce@albatross.co.nz>
To: apbianco@redhat.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/340: Static array initializer link failure with -O
Date: Wed, 11 Oct 2000 12:34:07 +1300
Alexandre Petit-Bianco wrote:
> Bryce McKinlay writes:
>
> > Here is my workaround:
>
> AG already checked something in in August a year ago. And it
> disappeared, most likely during a merge.
>
> ./A
>
> 2000-10-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
>
> * java_lang_expand_expr: Reinstall 1999-08-14 Anthony's
> patch. Fixed gcj/340.
This patch works fine - thanks.
regards
[ bryce ]
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Fri Oct 13 14:12:58 2000
State-Changed-Why:
I checked in a patch:
http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00374.html
(sans the ChangeLog entry typo.)
From: apbianco@cygnus.com
To: apbianco@cygnus.com, bryce@albatross.co.nz,
java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/340
Date: 13 Oct 2000 21:12:58 -0000
Synopsis: Static array initializer link failure with -O
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Fri Oct 13 14:12:58 2000
State-Changed-Why:
I checked in a patch:
http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00374.html
(sans the ChangeLog entry typo.)
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=340&database=java
From: Bryce McKinlay <bryce@albatross.co.nz>
To: apbianco@cygnus.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/340
Date: Thu, 19 Oct 2000 00:03:12 +1300
OK, here's a weird one.
Although this patch does seem to have mostly fixed the problem, the original
program I noticed this bug on ("jBYTEmark" -
http://waitaki.otago.ac.nz/~bryce/gcj/jbytemark-0.9+.tar.gz ), now fails to
compile at any -O level.
$ gcj *.java
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'
/tmp/ccHH7YSO.o: In function `__finit3Foo':
/home/bryce/downloads/jbyte/t2/Foo.java(.text+0x45): undefined reference to
`LJv0'
/home/bryce/downloads/jbyte/t2/Foo.java(.text+0x79): undefined reference to
`LJv1'
collect2: ld returned 1 exit status
This test is the closest I could come to extracting a test case - the
two-dimensional array seems to be the cause, but the problem doesn't appear
unless a reference to "Final" is present somewhere also. Additionally, if the
arrays in "odd" are made smaller, the problem doesnt appear either.
These classes must also be in separate .java files.
final class Final
{ static int i;}
class Foo
{
int [][] odd =
{
{0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,1,0,0,0},
{1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,1,1}
};
public static void main(String[] args)
{
int j = Final.i;
}
}
regards
[ bryce ]
apbianco@cygnus.com wrote:
> Synopsis: Static array initializer link failure with -O
>
> State-Changed-From-To: feedback->closed
> State-Changed-By: apbianco
> State-Changed-When: Fri Oct 13 14:12:58 2000
> State-Changed-Why:
> I checked in a patch:
>
> http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00374.html
>
> (sans the ChangeLog entry typo.)
>
> http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=340&database=java
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-12-20 12:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:25 java/1368: Static array initializer link failure with -O bryce
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).