Bug 127273 - Segmentation fault for java (gcj) involving precedence
Summary: Segmentation fault for java (gcj) involving precedence
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc32
Version: 2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-07-05 18:12 UTC by Larry Morell
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-07-05 18:29:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Larry Morell 2004-07-05 18:12:17 UTC
Description of problem:  When parens are omitted in the following
expression:
   String s = "abc" + (i instanceof Integer);

a segmentation fault occurs.  The type of i does not appear
to matter, i.e. a seg. fault occurs for several different types
declared for 'i' (Tried: String, Integer, int)


    

Version-Release number of selected component (if applicable):
gcj -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libgcj.spec
rename spec lib to liborig
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)


How reproducible:
The following seg faults:
public class Bug2 {
  public static void main (String args[]) {
     int i;
     String s = "abc" + i instanceof Integer;
  }
}



Steps to Reproduce:
1. Enter above into a file called 'Bug2.java'
2. javac Bug2.java
3.
  
Actual results:
javac Bug2.java
Bug2.java: In class `Bug2':
Bug2.java: In method `Bug2.main(java.lang.String[])':
Bug2.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:
'instanceof' should have lower precedence than '+' so the expression
should be interpreted as ("abc" + i) instanceof Integer, which
would result in a boolean.  Since a boolean cannot be assigned to
a String, the parser should have issued an error message.

Additional info:  This was actually run in RedHat 9.0

Comment 1 Jakub Jelinek 2004-07-05 18:29:45 UTC
So why are you reporting it against FC2, where it certainly works?
gcj --main=Bug2 -o /tmp/Bug2 /tmp/Bug2.java
/tmp/Bug2.java: In class `Bug2':
/tmp/Bug2.java: In method `Bug2.main(java.lang.String[])':
/tmp/Bug2.java:4: error: Impossible for `java.lang.String' to be instance of `java.lang.Integer'.
        String s = "abc" + i instanceof Integer;
                             ^
1 error

RHL9 is EOL, so don't expect any fixes there (well, for security fixes
you can be looking at the Fedora Legacy project, but for this kind of things
chances getting it fixed are close to zero unless you find some volunteer).

Comment 2 Larry Morell 2004-07-05 22:02:22 UTC
Many apologies ... I just downloaded gcc3.4 and found this to be fixed.


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