ruby-changes:47425
From: usa <ko1@a...>
Date: Wed, 9 Aug 2017 19:09:25 +0900 (JST)
Subject: [ruby-changes:47425] usa:r59541 (ruby_2_3): merge revision(s) 58503: [Backport #13523]
usa 2017-08-09 19:09:20 +0900 (Wed, 09 Aug 2017) New Revision: 59541 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59541 Log: merge revision(s) 58503: [Backport #13523] node.h: sign-extend * node.h (nd_line): should sign-extend. shifting `VALUE` extends with zero bits if `sizeof(VALUE)` equals to `sizeof(int)`. the zero bits are truncated if `sizeof(VALUE)` is bigger enough. [ruby-core:80920] [Bug #13523] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/node.h branches/ruby_2_3/test/ruby/test_parse.rb branches/ruby_2_3/version.h Index: ruby_2_3/test/ruby/test_parse.rb =================================================================== --- ruby_2_3/test/ruby/test_parse.rb (revision 59540) +++ ruby_2_3/test/ruby/test_parse.rb (revision 59541) @@ -876,6 +876,16 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_parse.rb#L876 assert_warning(/#{a}/) {eval("#{a} = 1; /(?<#{a}>)/ =~ ''")} end + def test_negative_line_number + bug = '[ruby-core:80920] [Bug #13523]' + obj = Object.new + obj.instance_eval("def t(e = false);raise if e; __LINE__;end", "test", -100) + assert_equal(-100, obj.t, bug) + assert_equal(-100, obj.method(:t).source_location[1], bug) + e = assert_raise(RuntimeError) {obj.t(true)} + assert_equal(-100, e.backtrace_locations.first.lineno, bug) + end + =begin def test_past_scope_variable assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 59540) +++ ruby_2_3/version.h (revision 59541) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-08-09" -#define RUBY_PATCHLEVEL 351 +#define RUBY_PATCHLEVEL 352 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_3/node.h =================================================================== --- ruby_2_3/node.h (revision 59540) +++ ruby_2_3/node.h (revision 59541) @@ -277,7 +277,7 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/ruby_2_3/node.h#L277 #define NODE_LSHIFT (NODE_TYPESHIFT+7) #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1) -#define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT) +#define nd_line(n) (int)(((SIGNED_VALUE)RNODE(n)->flags)>>NODE_LSHIFT) #define nd_set_line(n,l) \ RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT)) Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 59540) +++ ruby_2_3 (revision 59541) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r58503 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/