From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 Description of problem: Compiling: class BugToken { public void oops () { final char eofSym; switch (7) { case eofSym : ; } } } yields: javac BugToken.java BugToken.java: In class `BugToken': BugToken.java: In method `BugToken.oops()': BugToken.java:4: internal error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. Removing 'final' yields: BugToken.java: In class `BugToken': BugToken.java: In method `BugToken.oops()': BugToken.java:5: Constant expression required. case eofSym : ; ^ 1 error as hoped. Version-Release number of selected component (if applicable): gcc-3.2.2-5 How reproducible: Always Steps to Reproduce: 1. Using javac script supplied with Redhat 9 compile the program:class BugToken { public void oops () { assinal char eofSym; switch (7) { case eofSym : ; } } } Actual Results: javac BugToken.java BugToken.java: In class `BugToken': BugToken.java: In method `BugToken.oops()': BugToken.java:4: internal error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions. Expected Results: Should have compiled. Additional info:
*** Bug 118220 has been marked as a duplicate of this bug. ***
2004-03-15 Andrew Haley <aph> * parse.y (java_complete_lhs): Check that final variable has an initializer. Index: parse.y =================================================================== RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v retrieving revision 1.472 diff -p -2 -c -r1.472 parse.y *** parse.y 28 Feb 2004 00:34:25 -0000 1.472 --- parse.y 15 Mar 2004 15:22:24 -0000 *************** java_complete_lhs (tree node) *** 11654,11658 **** } /* Accept final locals too. */ ! else if (TREE_CODE (cn) == VAR_DECL && DECL_FINAL (cn)) cn = fold_constant_for_init (DECL_INITIAL (cn), cn); --- 11654,11659 ---- } /* Accept final locals too. */ ! else if (TREE_CODE (cn) == VAR_DECL && DECL_FINAL (cn) ! && DECL_INITIAL (cn)) cn = fold_constant_for_init (DECL_INITIAL (cn), cn);
Checked in to cvs HEAD. This will be fixed in gcc 3.5.