From mboxrd@z Thu Jan 1 00:00:00 1970 From: green@cygnus.com To: java-gnats@sourceware.cygnus.com Subject: java/1204: Definite assignment problem Date: Wed, 20 Dec 2000 12:21:00 -0000 Message-id: <20000213173341.21790.qmail@sourceware.cygnus.com> X-SW-Source: 2000-q4/msg00983.html List-Id: >Number: 1204 >Category: java >Synopsis: Definite assignment problem >Confidential: no >Severity: serious >Priority: medium >Responsible: apbianco >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Dec 20 12:17:32 PST 2000 >Closed-Date: >Last-Modified: Thu Apr 13 17:56:57 PDT 2000 >Originator: Anthony Green >Release: Latest cvs >Organization: >Environment: Red Hat Linux 6.1 >Description: The compiler is not recognizing a situation where a variable is guaranteed to be assigned to, and is exiting with a definite assignment error. This bug occurs with for local variables assigned within either a try/finally or try/catch block. >How-To-Repeat: I've checked in a test case: libjava.compile/assignment.java Also see libjava.compile/assignment_2.java >Fix: >Release-Note: >Audit-Trail: Formerly PR gcj/148 From: Bryce McKinlay To: green@cygnus.com, java-gnats@sourceware.cygnus.com Cc: Subject: Re: gcj/148: Definite assignment problem Date: Wed, 16 Feb 2000 22:13:31 +1300 Somewhat related - I'm getting the "Variable may not have been initialized" message from the latest compiler from cvs in totally bogus situations that used to work fine. This bug seems to have appeared recently (certainly since 19991213 which is the second-most-recent build I have lying around) In my case I have String var_value = line.substring(...); Variable v = new Variable(first_token, var_value.trim(), ...); and the compiler is telling me that var_value may not have been initialized. I'm going to try and come up with a test case... [ bryce ] green@cygnus.com wrote: > >Number: 148 > >Category: gcj > >Synopsis: Definite assignment problem > >Confidential: no > >Severity: serious > >Priority: medium > >Responsible: apbianco > >State: open > >Class: sw-bug > >Submitter-Id: net > >Arrival-Date: Sun Feb 13 09:40:02 PST 2000 > >Closed-Date: > >Last-Modified: > >Originator: Anthony Green > >Release: Latest cvs > >Organization: > >Environment: > Red Hat Linux 6.1 > >Description: > The compiler is not recognizing a situation > where a variable is guaranteed to be assigned to, > and is exiting with a definite assignment error. > >How-To-Repeat: > I've checked in a test case: libjava.compile/assignment.java > >Fix: > > >Release-Note: > >Audit-Trail: > >Unformatted: From: Bryce McKinlay To: java-gnats@sourceware.cygnus.com Cc: Subject: Re: gcj/148: Definite assignment problem Date: Wed, 16 Feb 2000 23:27:24 +1300 Here's my test case for this strange bug: interface I { int huk = 5; } public class DA implements I { DA(String s) {} private void tmp(String line) { String broken = line.substring(huk); DA da = new DA(broken); } } produces: DA.java: In class `DA': DA.java: In method `tmp(java.lang.String)': DA.java:13: Variable `broken' may not have been initialized. DA da = new DA(broken); Both the static variable being declared in an interface and calling a constructor with the result appear to be significant. Works fine in 2.95.2 & 19991213. Broken on 20000215. Works fine from .class file. [ bryce ] From: Bryce McKinlay To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com Cc: Subject: Re: gcj/148: Definite assignment problem Date: Thu, 17 Feb 2000 00:37:52 +1300 I narrowed the cause of this down to Anthony's Class Initialization Optimization patch. Removing the patch makes the problem go away. [ bryce ] From: Anthony Green To: bryce@albatross.co.nz Cc: java-gnats@sourceware.cygnus.com, apbianco@cygnus.com Subject: gcj/148: Definite assignment problem Date: Wed, 16 Feb 2000 09:48:02 -0800 Hi Bryce - > I narrowed the cause of this down to Anthony's Class Initialization > Optimization patch. Removing the patch makes the problem go away. Are you saying the toolchain you found the problem in was 20000215+my patch? I don't think I committed it (although I was so tired at the end, maybe I did by mistake?) Thanks, AG -- Anthony Green Red Hat Sunnyvale, California From: bryce@sourceware.cygnus.com To: java-gnats@sourceware.cygnus.com Cc: Subject: gcj/148 Date: 14 Apr 2000 00:47:35 -0000 CVSROOT: /cvs/java Module name: libgcj Changes by: bryce@sourceware.cygnus.com 00/04/13 17:47:35 Modified files: libjava/testsuite: ChangeLog Added files: libjava/testsuite/libjava.compile: assignment_2.java Log message: 2000-04-14 Bryce McKinlay Additional test for PR gcj/148: * libjava.compile/assignment_2.java: New file. Patches: http://gcc.gnu.org/cgi-bin/gcc/libjava/testsuite/ChangeLog.diff?cvsroot=java&r1=1.80&r2=1.81 http://gcc.gnu.org/cgi-bin/gcc/libjava/testsuite/libjava.compile/assignment_2.java.diff?cvsroot=java&r1=NONE&r2=1.1 >Unformatted: