Skip to content

Incorrect case tree selection when comparing Symbols during compiled Ruby code execution #8157

@jbaiza

Description

@jbaiza

Environment Information

  • JRuby versions 9.4.3.0 till 9.4.6.0 with empty JRUBY_OPTS
  • MacOS Sonoma 14.4 (23E214) with Apple M3 Max, also tried on debian Docker container:
Linux 3560b4ae4eac 6.5.11-linuxkit #1 SMP PREEMPT Wed Dec  6 17:08:31 UTC 2023 x86_64 GNU/Linux
  • Java versions:
    • OpenJDK Runtime Environment (Zulu 8.74.0.17-CA-macos-aarch64) (build 1.8.0_392-b08)
    • OpenJDK Runtime Environment Temurin-11.0.21+9 (build 11.0.21+9)

Other relevant info you may wish to add:

  • Plain JRuby without any gems

Expected Behavior

Use following files:

  • test.rb:
class ExampleClass
  def initialize
    case :abc
    when :abc
      puts "Correct"
    else
      puts "Incorrect"
    end
  end
end

ExampleClass.new
  • test1.rb:
load 'test.class'

Compile test.rb file using jrubyc test.rb.

Executing both files (test.rb and test1.rb) the same output should be displayed - Correct.

Actual Behavior

When the ruby file is executed using jruby test.rb, the output Correct is displayed.
When the compilled class via test1.rb file is executed using jruby test1.rb, the output is Incorrect.

During our testing we found that on different computers, the symbol count did matter. On some it worked with just :a, on some the error occurs only with :abc.

Using the git-bisect I have identified, that this behaviour started in commit 95ec181.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions