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]

gcc/java patch for emitting iinc opcode


This fixes a bug in the java bytecode generator when compiling
expresses like '(i -= 2) >= 0', where the result of an iinc
opcode is needed.

I checked this into the trunk, and wil check it into the gcc3 branch.

2001-03-17  Per Bothner  <per@bothner.com>

	* jcf-write.c (generate_bytecode_insns):  Handle emitting iinc
	when result is is needed (target is STACK_TARGET).

Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.72
diff -u -p -r1.72 jcf-write.c
--- jcf-write.c	2001/02/04 22:44:03	1.72
+++ jcf-write.c	2001/03/17 20:43:18
@@ -2009,6 +2009,8 @@ generate_bytecode_insns (exp, target, st
 		    if (TREE_CODE (rhs) == MINUS_EXPR)
 		      value = -value;
 		    emit_iinc (lhs, value, state);
+		    if (target != IGNORE_TARGET)
+		      emit_load (lhs, state);
 		    break;
 		  }
 	      }

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