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

ruby-changes:50017

From: usa <ko1@a...>
Date: Wed, 31 Jan 2018 22:16:34 +0900 (JST)
Subject: [ruby-changes:50017] usa:r62135 (ruby_2_3): merge revision(s) 60099, 60100: [Backport #13964]

usa	2018-01-31 22:16:25 +0900 (Wed, 31 Jan 2018)

  New Revision: 62135

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62135

  Log:
    merge revision(s) 60099,60100: [Backport #13964]
    
    compile.c: fix stack consitency error
    
    * compile.c (iseq_compile_each0): fix stack consitency error on
      attr-assign with safe navigation operator when the receiver is
      nil, should pop it too.  [ruby-core:83078] [Bug #13964]
    
    test_call.rb: refine test_safe_call
    
    * test/ruby/test_call.rb (test_safe_call): rhs should not be
      evaluated when the receiver is nil.  simplified the assertion
      for  [Bug #13964].

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/compile.c
    branches/ruby_2_3/test/ruby/test_call.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 62134)
+++ ruby_2_3/ChangeLog	(revision 62135)
@@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Wed Jan 31 22:16:00 2018  Nobuyoshi Nakada  <nobu@r...>
+
+	compile.c: fix stack consitency error
+
+	* compile.c (iseq_compile_each0): fix stack consitency error on
+	  attr-assign with safe navigation operator when the receiver is
+	  nil, should pop it too.  [ruby-core:83078] [Bug #13964]
+
+	test_call.rb: refine test_safe_call
+
+	* test/ruby/test_call.rb (test_safe_call): rhs should not be
+	  evaluated when the receiver is nil.  simplified the assertion
+	  for  [Bug #13964].
+
 Wed Jan 31 22:12:48 2018  Nobuyoshi Nakada  <nobu@r...>
 
 	adjust indent
Index: ruby_2_3/compile.c
===================================================================
--- ruby_2_3/compile.c	(revision 62134)
+++ ruby_2_3/compile.c	(revision 62135)
@@ -4751,8 +4751,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L4751
 		ADD_INSN1(ret, line, topn, INT2FIX(1));
 	    }
 	    ADD_SEND_WITH_FLAG(ret, line, aid, INT2FIX(1), INT2FIX(asgnflag));
+	    if (lskip && poped) {
+		ADD_LABEL(ret, lskip);
+	    }
 	    ADD_INSN(ret, line, pop);
-	    if (lskip) {
+	    if (lskip && !poped) {
 		ADD_LABEL(ret, lskip);
 	    }
 	}
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 62134)
+++ ruby_2_3/version.h	(revision 62135)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.7"
 #define RUBY_RELEASE_DATE "2018-01-31"
-#define RUBY_PATCHLEVEL 396
+#define RUBY_PATCHLEVEL 397
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_3/test/ruby/test_call.rb
===================================================================
--- ruby_2_3/test/ruby/test_call.rb	(revision 62134)
+++ ruby_2_3/test/ruby/test_call.rb	(revision 62135)
@@ -50,8 +50,9 @@ class TestCall < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_call.rb#L50
 
     o = nil
     assert_nil(o&.x)
-    assert_nothing_raised(NoMethodError) {o&.x = 6}
-    assert_nothing_raised(NoMethodError) {o&.x *= 7}
+    assert_nothing_raised(NoMethodError) {o&.x = raise}
+    assert_nothing_raised(NoMethodError) {o&.x *= raise}
+    assert_nothing_raised(NoMethodError) {o&.x *= raise; nil}
   end
 
   def test_safe_call_evaluate_arguments_only_method_call_is_made
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 62134)
+++ ruby_2_3	(revision 62135)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r60099-60100

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

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