Welcome to the main channel on the development of MoarVM, a virtual machine for NQP and Rakudo (moarvm.org). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
dogbert17 m: use nqp; nqp::splice(my int @a,array[int].new(:shape),0,1) 12:57
camelia (signal SEGV)
dogbert17 this is github.com/rakudo/rakudo/issues/4075 12:58
the problem seems, to my untrained eye, to start on this line: github.com/MoarVM/MoarVM/blob/mast...ray.c#L842 13:02
when REPR(src)->ID returns 39 (MVM_REPR_ID_MultiDimArray) instead of 1 (MVM_REPR_ID_VMArray)
at that point s_repr_data gets set to NULL which leads to a SEGV on line 864 13:03
timo good catch 16:24
the guard for "is s_repr_data not null" should perhaps guard both the then and else branch, and probably also have an exception thrown at the end 16:26
i would have said we must have been sure the repr id of at least source is always array at some point, perhaps when choosing if copy_elements is the right function to call 16:27
perhaps we just blindly copy-pasted copy-elements to the reprops of mvmmultidimarray? 16:28
dogbert17 timo: thx for looking, could it be the asplice function that maskes some kind of mistake? 19:32
#0 0x00007ffff78350f0 in copy_elements (tc=0x20000030080, src=0x200091178a0, dest=0x20009041e60, s_offset=0, d_offset=0, elems=1) at src/6model/reprs/VMArray.c:864
#1 0x00007ffff78358a1 in asplice (tc=0x20000030080, st=0x200038c11b8, root=0x20009041e60, data=0x20009041e78, from=0x200091178a0, offset=0, count=0) at src/6model/reprs/VMArray.c:1024
#2 0x00007ffff7794772 in MVM_interp_run (tc=0x20000030080, initial_invoke=0x7ffff7954c52 <toplevel_initial_invoke>, invoke_data=0x20000598800, outer_runloop=0x0) at src/core/interp.c:2260
timo we'll have to think about what exactly it means to splice a multidimarray. multidimarrays are supposed to be fixed-size, so either we forbid splicing a different-sized thing into the hole it makes, or if we do something like shuffle the default value or whatever in from the end 22:24
and splice uses single-dimension indices, how does it, just in general? 22:26