This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

[patch] Java definite assignment


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/

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