[patch] Java definite assignment

Per Bothner per@bothner.com
Mon Feb 5 17:36:00 GMT 2001


Without this patch gcj complains that
"Variable `xx' may not have been initialized":

  int xx;
  for (;;) {
    if (b) { xx = ...; break }
    ....
  }
  use(xx);

This does seem like the correct fix, but I haven't tested it seriously.
Could someone try applying it before their next build and testsuite-run?

        * check-init.c (check_init):  Don't call done_alternative after
        processing loop code, as a LOOP_EXPR never terminates normally.

Index: check-init.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/check-init.c,v
retrieving revision 1.26
diff -u -r1.26 check-init.c
--- check-init.c	2001/02/04 22:44:02	1.26
+++ check-init.c	2001/02/06 01:25:05
@@ -451,7 +451,6 @@
 	BEGIN_ALTERNATIVES (before, alt);
 	alt.block = exp;
 	check_init (TREE_OPERAND (exp, 0), before);
-	done_alternative (before, &alt);
 	END_ALTERNATIVES (before, alt);
 	return;
       }

-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


More information about the Java mailing list