[前][次][番号順一覧][スレッド一覧]

ruby-changes:12612

From: mame <ko1@a...>
Date: Thu, 30 Jul 2009 21:43:01 +0900 (JST)
Subject: [ruby-changes:12612] Ruby:r24323 (trunk): * compile.c (iseq_compile_each): fix stack consistency error.

mame	2009-07-30 21:42:41 +0900 (Thu, 30 Jul 2009)

  New Revision: 24323

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24323

  Log:
    * compile.c (iseq_compile_each): fix stack consistency error.
      [ruby-core:24611]
    * bootstraptest/test_method.rb: add tests for above.

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_method.rb
    trunk/compile.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24322)
+++ ChangeLog	(revision 24323)
@@ -1,3 +1,10 @@
+Thu Jul 30 21:39:42 2009  Yusuke Endoh  <mame@t...>
+
+	* compile.c (iseq_compile_each): fix stack consistency error.
+	  [ruby-core:24611]
+
+	* bootstraptest/test_method.rb: add tests for above.
+
 Thu Jul 30 18:39:39 2009  Martin Duerst  <duerst@i...>
 
 	* transcode.c: added check for frozen string for encode! (see Bug #1836)
Index: bootstraptest/test_method.rb
===================================================================
--- bootstraptest/test_method.rb	(revision 24322)
+++ bootstraptest/test_method.rb	(revision 24323)
@@ -1151,3 +1151,13 @@
     e.message == "undefined method `lalala!' for \"a\":String" ? :ok : :ng
   end
 }, '[ruby-core:22298]'
+
+assert_equal 'ok', %q{
+  "hello"[0] ||= "H"
+  "ok"
+}
+
+assert_equal 'ok', %q{
+  "hello"[0, 1] ||= "H"
+  "ok"
+}
Index: compile.c
===================================================================
--- compile.c	(revision 24322)
+++ compile.c	(revision 24323)
@@ -3799,12 +3799,8 @@
 	    }
 	    ADD_INSNL(ret, nd_line(node), jump, lfin);
 	    ADD_LABEL(ret, label);
-	    if (id == 0 || id == 1) {	/* 0: or, 1: and */
-		ADD_INSN(ret, nd_line(node), swap);
-		ADD_INSN(ret, nd_line(node), pop);
-		ADD_INSN(ret, nd_line(node), swap);
-		ADD_INSN(ret, nd_line(node), pop);
-	    }
+	    ADD_INSN1(ret, nd_line(node), setn, INT2FIX(FIX2INT(argc) + 1));
+	    ADD_INSN1(ret, nd_line(node), adjuststack, INT2FIX(FIX2INT(argc) + 1));
 	    ADD_LABEL(ret, lfin);
 	}
 	else {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]