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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: PR libgcj/8945


I'm checking this in on the trunk and the 3.3 branch.

This is a patch from Andrew for PR 8945 (actually the bug that 8945
should be, if it were really a bug report).

Test case included.  Built and checked on x86 RHL 7.3.

Tom

Index: gcc/java/ChangeLog
from  Andrew Haley  <aph@redhat.com>

	* parse.y (patch_invoke): Force evaluation order when `check' is
	set.  For PR libgcj/8945.

Index: gcc/java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.406
diff -u -r1.406 parse.y
--- gcc/java/parse.y 16 Dec 2002 18:22:36 -0000 1.406
+++ gcc/java/parse.y 19 Dec 2002 06:11:02 -0000
@@ -10793,7 +10793,11 @@
      is NULL.  */
   if (check != NULL_TREE)
     {
-      patch = build (COMPOUND_EXPR, TREE_TYPE (patch), check, patch);
+      /* We have to call force_evaluation_order now because creating a
+ 	 COMPOUND_EXPR wraps the arg list in a way that makes it
+ 	 unrecognizable by force_evaluation_order later.  Yuk.  */
+      patch = build (COMPOUND_EXPR, TREE_TYPE (patch), check, 
+ 		     force_evaluation_order (patch));
       TREE_SIDE_EFFECTS (patch) = 1;
     }
 
Index: libjava/testsuite/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* libjava.lang/pr8945.java: New file.
	* libjava.lang/pr8945.out: New file.

Index: libjava/testsuite/libjava.lang/pr8945.java
===================================================================
RCS file: libjava/testsuite/libjava.lang/pr8945.java
diff -N libjava/testsuite/libjava.lang/pr8945.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/testsuite/libjava.lang/pr8945.java 19 Dec 2002 06:11:05 -0000
@@ -0,0 +1,9 @@
+public class pr8945
+{
+  public static void main(String[] args)
+  {
+    String foo = "hello";
+    int pos = 3;
+    System.out.println(foo.substring(pos,++pos));
+  }
+}
Index: libjava/testsuite/libjava.lang/pr8945.out
===================================================================
RCS file: libjava/testsuite/libjava.lang/pr8945.out
diff -N libjava/testsuite/libjava.lang/pr8945.out
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/testsuite/libjava.lang/pr8945.out 19 Dec 2002 06:11:05 -0000
@@ -0,0 +1 @@
+l


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