You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code to reproduce is on play 47hw, but also included here:
module Base
getter parent : Base?
end
class Evnt
getter parent : Base
def initialize(@parent)
end
end
class MainObj
include Base
property event : Evnt?
end
o = MainObj.new
o.event = Evnt.new(o)
puts "Next two lines of output should be MainObj and Nil"
p o.event.not_nil!.parent.class
p o.parent.class
puts "Next line of output should be MainObj, and program should"
puts "then exit due to condition no longer being true"
puts "But the output is MainObj and MainObj, and program segfaults."
el = o.event.not_nil!
while el = el.parent
puts el.class
end
Crystal version is 0.24.2 binary tgz build from Crystal website.
Crystal 0.24.2 [4f9ed8d] (2018-03-08)
LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu
Thanks!
The text was updated successfully, but these errors were encountered:
Just for info, the same program converted to Ruby works fine:
module Base
attr_reader :parent
end
class Evnt
attr_reader :parent
def initialize(parent)
@parent = parent
end
end
class MainObj
include Base
attr_accessor :event
end
o = MainObj.new
o.event = Evnt.new(o)
puts "Next two lines of output should be MainObj and Nil"
p o.event.parent.class
p o.parent.class
puts "Next line of output should be MainObj, and program should"
puts "then exit due to condition no longer being true"
el = o.event
while el = el.parent
puts el.class
end
classClass1property parent : self?
endclassClass2# If the following property is optional/nilable (type "Class1?"), program works.# If it is not optional (type "Class1"), it segfaults.property parent : Class1definitialize(@parent) endend
c1 =Class1.new
c2 =Class2.new(c1)
el = c2.not_nil!
while el = el.parent
puts el.class
end
Hello,
I am not sure if this issue is similar / same like:
#4916
From what I can tell, running a loop with different object types reads something incorrectly and receives signal 11:
Code to reproduce is on play 47hw, but also included here:
Crystal version is 0.24.2 binary tgz build from Crystal website.
Crystal 0.24.2 [4f9ed8d] (2018-03-08)
LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu
Thanks!
The text was updated successfully, but these errors were encountered: