This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

almost a cosmetic bug


I have found a strange behavior of gcj on erroneous code which should
just output a syntax error message.

This is with the CVS head of Janury 31.


Basically the compiler segfault rather than reporting a syntax error
message if it tries to set a variable from the return value of a method call 
which is erroneously written.

Confused? Here an example: 

  Test test = new Test ();
  boolean b;

  b = test.result();    // ok, compile fine
  test.result();        // ok, compile fine
  test.result ;         // ok, report a syntax error
  b = test.result ;     // WRONG, compiler segfault




gcj --main=Test -o Test Test.java

Test.java: In class `Test':
Test.java: In method `Test.main(java.lang.String[])':
Test.java:9: Internal error: Segmentation fault.
Please submit a full bug report, with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

This is the code:

//////////////////////////////////////////////////////////////////////
public class Test
{
    public static void main (String[] args) 
    {
        boolean b = false;

        Test test = new Test ();
        b = test.result;           // segfault

        System.out.println (b);
    }

    public boolean result () {
        return true;
    }
}
//////////////////////////////////////////////////////////////////////

Olivier

-- 
Olivier Louchart-Fletcher
Email: olivier@zipworld.com.au


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]