Bug 8923 - [4.0/4.1 Regression] ICE when modifying a variable decleared "final static"
[4.0/4.1 Regression] ICE when modifying a variable decleared "final static"
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: java
3.2.1
: P5 normal
: 4.3.0
Assigned To: Not yet assigned to anyone
: ice-on-invalid-code
: 25664 (view as bug list)
Depends on: 28067
Blocks: 27439
  Show dependency treegraph
 
Reported: 2002-12-13 03:06 UTC by torkel
Modified: 2007-01-09 20:44 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.0.4 4.2.0
Known to fail: 3.3.3 3.4.0 4.0.0 4.1.0
Last reconfirmed: 2004-05-23 17:34:21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description torkel 2002-12-13 03:06:01 UTC
$ gcj -C myBug.java

myBug.java: In class `myBug':
myBug.java: In method `myBug.bug()':
myBug.java:5: Internal compiler error in generate_bytecode_insns, at java/jcf-write.c:1974
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
3.2.1

Environment:
Linux 2.4.20. Tested on AMD K6 and Athlon

How-To-Repeat:
public class myBug
{
        final static int myConst = 200;

        public static void bug() { myConst++;   /* ICE */ }
}
Comment 1 Andrew Pinski 2003-05-25 23:31:44 UTC
still fails on the mainline (20030525):
gcj -C myBug.java 
myBug.java: In class `myBug':
myBug.java: In method `myBug.bug()':
myBug.java:6: internal compiler error: in generate_bytecode_insns, at java/jcf-
write.c:1900
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


(gdb) bt
#0  0x4202bb8a in exit () from /lib/i686/libc.so.6
#1  0x0811487a in diagnostic_action_after_output (context=0x4212dc80, diagnostic=
0x83) at /home/gates/pinskia/src/gnu/gcc/src/gcc/diagnostic.c:963
#2  0x08114c6c in diagnostic_report_diagnostic (context=0x8454ac0, diagnostic=
0xbffebf60) at /home/gates/pinskia/src/gnu/gcc/src/gcc/diagnostic.c:1102
#3  0x08115111 in internal_error (msgid=0x83 <Address 0x83 out of bounds>) at /home/
gates/pinskia/src/gnu/gcc/src/gcc/diagnostic.c:1311
#4  0x081155df in fancy_abort (file=0x83 <Address 0x83 out of bounds>, line=
1108532352, function=0x83 <Address 0x83 out of bounds>) at /home/gates/pinskia/src/
gnu/gcc/src/gcc/diagnostic.c:1458
#5  0x080cccae in generate_bytecode_insns (exp=0x4005d898, target=2, state=
0xbffec340) at /home/gates/pinskia/src/gnu/gcc/src/gcc/java/jcf-write.c:1900
#6  0x080c9211 in generate_bytecode_insns (exp=0x4004c4e0, target=2, state=
0xbffec340) at /home/gates/pinskia/src/gnu/gcc/src/gcc/java/jcf-write.c:1436
#7  0x080c8609 in generate_bytecode_insns (exp=0x400ad268, target=2, state=
0xbffec340) at /home/gates/pinskia/src/gnu/gcc/src/gcc/java/jcf-write.c:1406
#8  0x080cef99 in generate_classfile (clas=0x40077af8, state=0xbffec340) at /home/
gates/pinskia/src/gnu/gcc/src/gcc/java/jcf-write.c:2972
#9  0x080d075e in write_classfile (clas=0x40077af8) at /home/gates/pinskia/src/gnu/gcc/
src/gcc/java/jcf-write.c:3381
#10 0x0806ad1f in java_expand_classes () at parse.y:9020
#11 0x080be552 in java_parse_file (set_yydebug=0) at /home/gates/pinskia/src/gnu/gcc/
src/gcc/java/jcf-parse.c:1119
#12 0x0830096a in compile_file () at /home/gates/pinskia/src/gnu/gcc/src/gcc/
toplev.c:2209
#13 0x08306528 in do_compile () at /home/gates/pinskia/src/gnu/gcc/src/gcc/
toplev.c:5581
#14 0x08306599 in toplev_main (argc=131, argv=0x0) at /home/gates/pinskia/src/gnu/
gcc/src/gcc/toplev.c:5612
#15 0x080d9a2b in main (argc=131, argv=0x83) at /home/gates/pinskia/src/gnu/gcc/src/
gcc/main.c:37
(gdb) p debug_tree(exp)
 <integer_cst 0x4005d898 type <integer_type 0x40050360 int> constant tree_0 200>
Comment 2 Andrew Pinski 2003-07-11 20:38:48 UTC
still ICEs on the mainline (20030711).
Comment 3 Andrew Pinski 2003-11-19 06:39:49 UTC
Note this fails both on the bytecode generator and the native code generator (at least on 
powerpc-apple-darwin7.0.0, 20031018).
Comment 4 Andrew Pinski 2004-05-23 17:34:20 UTC
Now it ICEs when gimplification happens:
gimplification failed:
200 <integer_cst 0x400c7288 type <integer_type 0x4004f414 int> constant invariant tree_0 200>
myBug.java: In class `myBug':
myBug.java: In method `myBug.bug()':
myBug.java:6: internal compiler error: in gimplify_expr, at gimplify.c:3576
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 5 Andrew Pinski 2006-01-08 15:24:04 UTC
*** Bug 25664 has been marked as a duplicate of this bug. ***
Comment 6 Debian GCC Maintainers 2006-04-23 11:00:46 UTC
test case from http://bugs.debian.org/351512

class gcjbug {
    public static void main (String [] p) {
        System.out.println(1++);
    }
}
Comment 7 Mark Mitchell 2006-05-25 02:35:20 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 8 Simon Martin 2006-07-27 07:06:52 UTC
I've posted a patch for the test case given in comment #6 here:
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg01142.html
Comment 9 Andrew Haley 2006-08-10 19:35:15 UTC
Subject: Bug 8923

Author: aph
Date: Thu Aug 10 19:35:07 2006
New Revision: 116069

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116069
Log:
2006-08-10  Simon Martin  <simartin@users.sourceforge.net>

        PR java/8923
        * parse.y (build_incdec): Emit an error instead of an ICE if '++'
        or '--' is used with a constant operand.
        (java_complete_lhs): When processing a '++' or '--' expression,
        don't call java_complete_tree but java_complete_lhs, so that a
        static final variable operand is never replaced by its value. This
        avoids an ICE later on.
        (patch_unaryop): Fixed typo in comment.


Modified:
    trunk/gcc/java/ChangeLog
    trunk/gcc/java/parse.y

Comment 10 Andrew Pinski 2006-08-10 22:02:07 UTC
Fixed on the mainline.
Comment 11 Tom Tromey 2007-01-09 20:44:33 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.
Thanks.