Bug 118219 - gjc internal error: Segmentation fault involving switch to a final var
gjc internal error: Segmentation fault involving switch to a final var
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Andrew Haley
:
: 118220 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-13 15:12 EST by Larry Morell
Modified: 2007-04-18 13:04 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-15 12:56:39 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Larry Morell 2004-03-13 15:12:16 EST
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 08:11:14 EST
*** Bug 118220 has been marked as a duplicate of this bug. ***
Comment 2 Andrew Haley 2004-03-15 10:18:04 EST
2004-03-15  Andrew Haley  <aph@redhat.com>

	* 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 12:56:39 EST
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.