This is the mail archive of the java-prs@sources.redhat.com 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]

Re: gcj/304: Definate assignment with switch


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
Cc:  
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 ]
 
 

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