Patch for PR gcj/268

Tom Tromey tromey@cygnus.com
Sun Jun 25 10:36:00 GMT 2000


Here is an updated version of my patch for PR gcj/268.  I'm still not
convinced this is the correct patch, and it does feel rather hacky to
me.  Perhaps it would be better to modify lex.c to only return
expressions and never constants?  I don't know (but I'd be interested
in finding out).

2000-06-25  Tom Tromey  <tromey@cygnus.com>

	* parse.y (for_statement): Don't use EXPR_WFL_LINECOL if
	expression is a constant.  For PR gcj/268.

Tom

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.181
diff -u -r1.181 parse.y
--- parse.y	2000/06/25 17:28:35	1.181
+++ parse.y	2000/06/25 17:33:46
@@ -1631,7 +1631,12 @@
 
 for_statement:
 	for_begin SC_TK expression SC_TK for_update CP_TK statement
-		{ $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7); }
+		{
+		  int loc = 0;
+		  if (TREE_CODE_CLASS (TREE_CODE ($3)) != 'c')
+		    loc = EXPR_WFL_LINECOL ($3);
+		  $$ = finish_for_loop (loc, $3, $5, $7);
+		}
 |	for_begin SC_TK SC_TK for_update CP_TK statement
 		{ 
 		  $$ = finish_for_loop (0, NULL_TREE, $4, $6);


More information about the Gcc-patches mailing list