This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
java/1399: gcj fails to compile "jBYTEmark" from source code when optimization is used
- To: java-gnats at sourceware dot cygnus dot com
- Subject: java/1399: gcj fails to compile "jBYTEmark" from source code when optimization is used
- From: bryce at albatross dot co dot nz
- Date: 18 Aug 1999 11:54:40 -0000
- Reply-To: bryce at albatross dot co dot nz
>Number: 1399
>Category: java
>Synopsis: gcj fails to compile "jBYTEmark" from source code when optimization is used
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 20 12:19:38 PST 2000
>Closed-Date: Thu Oct 21 22:39:46 PDT 1999
>Last-Modified: Thu Oct 21 22:40:00 PDT 1999
>Originator: Bryce McKinlay
>Release: gcc version 2.95.1 19990816 (release)
>Organization:
>Environment:
Linux
>Description:
gcj gives linking errors when attempting to compile
jBYTEmark with any optimization switches. If -O3 is used,
gcj segfaults.
Compiling jBYTEmark from bytecode works well when an
intermediate compiler is used (javac). Compiling without
optimization also works successfully.
>How-To-Repeat:
"jBYTEmark" source code is available from http://www.albatross.co.nz/~bryce/gcjbench/
gcj -O *.java -o jbytemark --main=jBYTEmark
>Fix:
>Release-Note:
>Audit-Trail:
Formerly PR gcj/37
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Mon Aug 23 16:16:15 1999
State-Changed-Why:
It seems that this bug might have been fixed by Anthony
on August 14th. Here's the patch:
1999-08-14 Anthony Green <green@cygnus.com>
* expr.c (java_lang_expand_expr): Mark static array data as
referenced.
Index: expr.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/expr.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -p -r1.46 -r1.47
--- expr.c 1999/08/10 16:58:12 1.46
+++ expr.c 1999/08/15 08:31:56 1.47
@@ -1944,6 +1944,7 @@ java_lang_expand_expr (exp, target, tmod
DECL_INITIAL (init_decl) = init;
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 = init_decl;
}
Note: I can get my current egcs tree on a Debian box to compile
and link it correctly with the -O2 flag. I can also reproduce
the -O3 SEGV problem on two files: `EmFloatPnt.java' and
`NeuralNetTest.java'. I'll have a look at it.
From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: bryce@albatross.co.nz, green@cygnus.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/37
Date: Wed, 20 Oct 1999 01:53:16 -0700 (PDT)
apbianco@cygnus.com writes:
> Note: I can get my current egcs tree on a Debian box to compile
> and link it correctly with the -O2 flag. I can also reproduce
> the -O3 SEGV problem on two files: `EmFloatPnt.java' and
> `NeuralNetTest.java'. I'll have a look at it.
Bryce, can you try the following patch on a fairly recent gcj source
tree, if you have one. Like, one that fixes the qualified expression
problems people reported this summer but still builds. I can't test
this patch right now, the source tree seems to be completely broken --
at least for my Debian box: `genattr' and/or the matching `md' file
seem to have gone completely south.
./A
Wed Oct 20 01:41:47 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (java_complete_tree): fold_constant_for_init to work
on permanent_obstack.
(java_complete_lhs): Likewise.
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/20 08:42:31
@@ -8028,7 +8028,9 @@ java_complete_tree (node)
{
tree value = DECL_INITIAL (node);
DECL_INITIAL (node) = NULL_TREE;
+ push_obstacks (&permanent_obstack, &permanent_obstack);
value = fold_constant_for_init (value, node);
+ pop_obstacks ();
DECL_INITIAL (node) = value;
if (value != NULL_TREE)
return value;
@@ -8230,8 +8232,12 @@ java_complete_lhs (node)
&& JDECL_P (TREE_OPERAND (cn, 1))
&& FIELD_FINAL (TREE_OPERAND (cn, 1))
&& DECL_INITIAL (TREE_OPERAND (cn, 1)))
- cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
- TREE_OPERAND (cn, 1));
+ {
+ push_obstacks (&permanent_obstack, &permanent_obstack);
+ cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
+ TREE_OPERAND (cn, 1));
+ pop_obstack ();
+ }
if (!TREE_CONSTANT (cn) && !flag_emit_xref)
{
@@ -8484,7 +8490,11 @@ java_complete_lhs (node)
&& TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
&& DECL_INITIAL (nn) != NULL_TREE)
{
- tree value = fold_constant_for_init (nn, nn);
+ tree value;
+
+ push_obstacks (&permanent_obstack, &permanent_obstack);
+ value = fold_constant_for_init (nn, nn);
+ pop_obstack ();
if (value != NULL_TREE)
{
tree type = TREE_TYPE (value);
From: Bryce McKinlay <bryce@albatross.co.nz>
To: Alexandre Petit-Bianco <apbianco@cygnus.com>
Cc: green@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: gcj/37
Date: Thu, 21 Oct 1999 11:23:10 +1300
Alexandre Petit-Bianco wrote:
> Bryce, can you try the following patch on a fairly recent gcj source
> tree, if you have one. Like, one that fixes the qualified expression
> problems people reported this summer but still builds. I can't test
> this patch right now, the source tree seems to be completely broken --
> at least for my Debian box: `genattr' and/or the matching `md' file
> seem to have gone completely south.
Hi,
I applied your patch to yesterday's gcc tree (which compiled okay for me apart
from libstdc++ problems. It compiles libgcj fine)
Before the patch it compiles jbytemark from .class with -O3, and from .java with
-O2 (but not -O3). After applying the patch it still crashes with -O3, but only
on one file.
Here's a backtrace (after applying patch)
(gdb) run EMFloatTest.java -fno-use-divide-subroutine -quiet -O3 -version -o
/tmp/ccIiOMva.s
Starting program: /usr/local/egcs/lib/gcc-lib/i686-pc-linux-gnu/2.96/jc1
EMFloatTest.java -fno-use-divide-subroutine -quiet -O3 -version -o
/tmp/ccIiOMva.s
GNU Java version 2.96 19991019 (experimental) (i686-pc-linux-gnu) compiled by
GNU C version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
Program received signal SIGSEGV, Segmentation fault.
0x80c78a6 in output_constant (exp=0x82aeb4c, size=1) at ../../gcc/varasm.c:4014
4014 register enum tree_code code = TREE_CODE (TREE_TYPE (exp));
(gdb) bt
#0 0x80c78a6 in output_constant (exp=0x82aeb4c, size=1) at
../../gcc/varasm.c:4014
#1 0x80c7d21 in output_constructor (exp=0x8274f3c, size=16) at
../../gcc/varasm.c:4274
#2 0x80c7a3c in output_constant (exp=0x8274f3c, size=16) at
../../gcc/varasm.c:4104
#3 0x80c4ea4 in assemble_variable (decl=0x82b1268, top_level=1, at_end=1,
dont_output_data=0) at ../../gcc/varasm.c:1650
#4 0x8078a78 in rest_of_decl_compilation (decl=0x82b1268, asmspec=0x0,
top_level=1,
at_end=1) at ../../gcc/toplev.c:3491
#5 0x8077905 in wrapup_global_declarations (vec=0xbffff964, len=61)
at ../../gcc/toplev.c:2688
#6 0x8078438 in compile_file (name=0xbffffc50 "EMFloatTest.java")
at ../../gcc/toplev.c:3240
#7 0x807b4fc in main (argc=8, argv=0xbffffae4) at ../../gcc/toplev.c:5552
BTW: "pop_obstack ()" should be "pop_obstacks ()" I presume?
> ./A
>
> Wed Oct 20 01:41:47 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
>
> * parse.y (java_complete_tree): fold_constant_for_init to work
> on permanent_obstack.
> (java_complete_lhs): Likewise.
>
> 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/20 08:42:31
> @@ -8028,7 +8028,9 @@ java_complete_tree (node)
> {
> tree value = DECL_INITIAL (node);
> DECL_INITIAL (node) = NULL_TREE;
> + push_obstacks (&permanent_obstack, &permanent_obstack);
> value = fold_constant_for_init (value, node);
> + pop_obstacks ();
> DECL_INITIAL (node) = value;
> if (value != NULL_TREE)
> return value;
> @@ -8230,8 +8232,12 @@ java_complete_lhs (node)
> && JDECL_P (TREE_OPERAND (cn, 1))
> && FIELD_FINAL (TREE_OPERAND (cn, 1))
> && DECL_INITIAL (TREE_OPERAND (cn, 1)))
> - cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
> - TREE_OPERAND (cn, 1));
> + {
> + push_obstacks (&permanent_obstack, &permanent_obstack);
> + cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
> + TREE_OPERAND (cn, 1));
> + pop_obstack ();
> + }
>
> if (!TREE_CONSTANT (cn) && !flag_emit_xref)
> {
> @@ -8484,7 +8490,11 @@ java_complete_lhs (node)
> && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
> && DECL_INITIAL (nn) != NULL_TREE)
> {
> - tree value = fold_constant_for_init (nn, nn);
> + tree value;
> +
> + push_obstacks (&permanent_obstack, &permanent_obstack);
> + value = fold_constant_for_init (nn, nn);
> + pop_obstack ();
> if (value != NULL_TREE)
> {
> tree type = TREE_TYPE (value);
From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: Bryce McKinlay <bryce@albatross.co.nz>
Cc: green@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: gcj/37
Date: Wed, 20 Oct 1999 15:45:28 -0700 (PDT)
Bryce McKinlay writes:
> I applied your patch to yesterday's gcc tree (which compiled okay
> for me apart from libstdc++ problems. It compiles libgcj fine)
I was able to build again the java bits (compiler and RT) today on a
RHS box.
> Before the patch it compiles jbytemark from .class with -O3, and
> from .java with -O2 (but not -O3). After applying the patch it still
> crashes with -O3, but only on one file.
Wierd. I don't see that happening. Here's what I get:
apbianco@deliverance[~/support/net/PRs/37/jbyte]: uname -a
Linux deliverance.cygnus.com 2.2.5-22smp #1 SMP Wed Jun 2 09:11:51 EDT 1999 i686 unknown
apbianco@deliverance[~/support/net/PRs/37/jbyte]: cat /etc/issue
Red Hat Linux release 6.0 (Hedwig)
Kernel 2.2.5-22smp on an i686
apbianco@deliverance[~/support/net/PRs/37/jbyte]: ~/build/egcs/i686-pc-linux-gnu/gcc/jc1 EMFloatTest.java -version -O3 -fno-use-divide-subroutine -o EMFloatTest.s -quiet
GNU Java version 2.96 19991020 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 2.96 19991005 (experimental).
apbianco@deliverance[~/support/net/PRs/37/jbyte]:
> Program received signal SIGSEGV, Segmentation fault.
> 0x80c78a6 in output_constant (exp=0x82aeb4c, size=1) at ../../gcc/varasm.c:4014
> 4014 register enum tree_code code = TREE_CODE (TREE_TYPE (exp));
> (gdb) bt
OK. I have two questions:
- Can you do a `p ((tree)0x82aeb4c)->common.type' and a
`p debug_tree (0x82b1268)' and send me the result?
- Is it an up-to-date java/ source tree that you patched?
> BTW: "pop_obstack ()" should be "pop_obstacks ()" I presume?
Absolutely. I was going to post a revised patch. Sorry.
./A
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Thu Oct 21 22:39:46 1999
State-Changed-Why:
I checked in this patch: http://egcs.cygnus.com/ml/gcc-patches/1999-10/msg00581.html
From: apbianco@cygnus.com
To: apbianco@cygnus.com, bryce@albatross.co.nz,
java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: gcj/37
Date: 22 Oct 1999 05:39:46 -0000
Synopsis: gcj fails to compile "jBYTEmark" from source code when optimization is used
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Thu Oct 21 22:39:46 1999
State-Changed-Why:
I checked in this patch: http://egcs.cygnus.com/ml/gcc-patches/1999-10/msg00581.html
http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=37
>Unformatted: