Project

General

Profile

Bug #15906

a=a のような式をもつ条件分岐が意図しない挙動をする

Added by nagachika (Tomoyuki Chikanaga) 5 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-dev:50792]

Description

[ruby-list:50781] から一部転載します。

下記スクリプトの結果が期待と違います。なぜでしょうか?
a = a は不要ですが、なにもしないことを明示するために書いたものです。
なおOS付属の ruby 2.3.7p456 では期待通りの結果でした。


a = "aaa"
if a == "bbb" || a == "ccc" then
    a = a
else
    puts "OK"
end
puts "END"



実行結果 
 END

期待する結果 
 OK
 END

動作環境
 MacOS 10.13.6
 ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin17]
 macportsでインストール

r63870 から発生するようになっているようです。

Associated revisions

Revision a6a26e42
Added by mame (Yusuke Endoh) 5 months ago

compile.c: Partially revert r63870 which caused wrong optimization

[Bug #15906]

Revision 4e12051f
Added by nagachika (Tomoyuki Chikanaga) 3 months ago

merge revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d: [Backport #15906]

    compile.c: Partially revert r63870 which caused wrong optimization

    [Bug #15906]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 67716
Added by nagachika (Tomoyuki Chikanaga) 3 months ago

merge revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d: [Backport #15906]

compile.c: Partially revert r63870 which caused wrong optimization

[Bug #15906]

Revision 235e64c2
Added by usa (Usaku NAKAMURA) about 2 months ago

merge revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d: [Backport #15906]

    compile.c: Partially revert r63870 which caused wrong optimization
    [Bug #15906]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 67757
Added by usa (Usaku NAKAMURA) about 2 months ago

merge revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d: [Backport #15906]

compile.c: Partially revert r63870 which caused wrong optimization
[Bug #15906]

History

#1

Updated by mame (Yusuke Endoh) 5 months ago

  • Status changed from Open to Closed

Applied in changeset git|a6a26e42b15c46f117f4fce07a2050e9d727355d.


compile.c: Partially revert r63870 which caused wrong optimization

[Bug #15906]

Updated by nagachika (Tomoyuki Chikanaga) 3 months ago

  • Backport changed from 2.4: DONTNEED, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: REQUIRED, 2.6: DONE

ruby_2_6 r67716 merged revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d.

Updated by usa (Usaku NAKAMURA) about 2 months ago

  • Backport changed from 2.4: DONTNEED, 2.5: REQUIRED, 2.6: DONE to 2.4: DONTNEED, 2.5: DONE, 2.6: DONE

ruby_2_5 r67757 merged revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d.

Also available in: Atom PDF