Project

General

Profile

Actions

Bug #13298

closed

mingw SEGV TestEnumerable#test_callcc

Added by MSP-Greg (Greg L) about 7 years ago. Updated over 1 year ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-03-09 trunk 57821) [x64-mingw32]
[ruby-core:79983]
Tags:

Description

First week in January, when I first started building, I had a SEGV in test-all occurring in TestEnumerable#test_callcc. I patched around it, but decided it was time to see if I could find a solution.

The issue occurs in test/ruby/test_enum.rb:559-570. Below is the code:

assert_raise(RuntimeError) do
  c = nil
  o = Object.new
  class << o; self; end.class_eval do
    define_method(:<=>) do |x|
      callcc {|c2| c ||= c2 }
      0
    end
  end
  [o, o].sort_by {|x| x }
  c.call
end

While trying to determine the problem in a separate test environment, I stumbled across an odd solution.

Add the line c.to_s immediately before the c.call line. My system no longer stops.

I'd be happy to do a PR, but I can only test on Windows.

Two questions --

  1. Might all of tests that involve callcc or Continuation be moved into another test file? Since it is considered 'obsolete'... I'd be happy to do.

  2. Rather odd that this fixes the issue. Any ideas?

--- test/ruby/test_enum.rb.orig	Thu Mar 09 07:54:37 2017
+++ test/ruby/test_enum.rb	Thu Mar 09 11:39:07 2017
@@ -568,2 +568,3 @@
       [o, o].sort_by {|x| x }
+      c.to_s
       c.call


Files

test_enum_559.txt (10.6 KB) test_enum_559.txt MSP-Greg (Greg L), 03/09/2017 08:56 PM
x64-mingw32-callcc-test.rb (434 Bytes) x64-mingw32-callcc-test.rb Repro derived from `TestHash#test_callcc` in `test/ruby/test_hash.rb` xtkoba (Tee KOBAYASHI), 06/04/2021 01:14 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0