Bug 127273 - Segmentation fault for java (gcj) involving precedence
Segmentation fault for java (gcj) involving precedence
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: gcc32 (Show other bugs)
2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-07-05 14:12 EDT by Larry Morell
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-07-05 14:29:45 EDT
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-07-05 14:12:17 EDT
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 14:29:45 EDT
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 18:02:22 EDT
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.