Bug 118219 - gjc internal error: Segmentation fault involving switch to a final var
Summary: gjc internal error: Segmentation fault involving switch to a final var
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Andrew Haley
QA Contact:
URL:
Whiteboard:
: 118220 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-03-13 20:12 UTC by Larry Morell
Modified: 2007-04-18 17:04 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-03-15 17:56:39 UTC
Embargoed:


Attachments (Terms of Use)

Description Larry Morell 2004-03-13 20:12:16 UTC
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:

Comment 1 Jakub Jelinek 2004-03-15 13:11:14 UTC
*** Bug 118220 has been marked as a duplicate of this bug. ***

Comment 2 Andrew Haley 2004-03-15 15:18:04 UTC
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);
  

Comment 3 Andrew Haley 2004-03-15 17:56:39 UTC
Checked in to cvs HEAD.  This will be fixed in gcc 3.5.



Note You need to log in before you can comment on or make changes to this bug.