gcj/304: Definate assignment with switch

Bryce McKinlay bryce@albatross.co.nz
Sun Dec 10 16:16:00 GMT 2000

The following reply was made to PR gcj/304; it has been noted by GNATS.

From: Bryce McKinlay <bryce@albatross.co.nz>
To: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/304: Definate assignment with switch
Date: Mon, 11 Dec 2000 13:09:01 +1300

 bryce@albatross.co.nz wrote:
 > The following example is illegal because 'r' may not have
 > been assigned when it is concatenated. gcj does not pick
 > up this error.
 Here's another similar situation where gcj fails to report a
 lack-of-definate-assignment error:
 public class DefinateAssign
   DefinateAssign next;
   public Object a()
     DefinateAssign e;
     if (next != null)
       e = next;
     if (e == null)
  e = new DefinateAssign();
     return e;
 In this case "e" can end up being a garbage pointer, which will cause
 weird crashes elsewhere. I got tripped up by this badly, guess I
 should have tried to compile with jikes ;-)
   [ bryce ]

More information about the Java-prs mailing list