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
Have been exploring ribbit a bit lately, and working on a Zig implementation (which will probably diverge a lot from this as I explore additions to the RVM). Anyway, in the midst of trying to understand the RVM decoding, I encountered the following on a fresh git clone:
As you can see, string-ref is in there, so the segfault is not occurring due to an unknown procedure or something (it would seem). Loading gdb:
~/tmp/ribbit/src $ gcc -g -o rvm.min.g repl-min.scm.c
~/tmp/ribbit/src $ ./rvm.min.g
> (string-ref "hello" 1)
Segmentation fault (core dumped)
~/tmp/ribbit/src $ gdb ./rvm.min.g
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./rvm.min.g...
(gdb) run
Starting program: /home/apg/tmp/ribbit/src/rvm.min.g
> (string-ref "hello" 1)
Program received signal SIGSEGV, Segmentation fault.
prim (no=6) at repl-min.scm.c:440
440 push2(CAR(x), PAIR_TAG);
I'd try this with min-tc, which I suspect might provide more clues, but that doesn't exist.
I did test the min defintions of list-ref and list-tail in chicken "just to be sure":
#;1> (define (list-ref lst i)
(car (list-tail lst i)))
Note: assignment to imported value binding: list-ref
#;2> (define (list-tail lst i)
(if (< 0 i) (list-tail (cdr lst) (- i 1)) lst))
Note: assignment to imported value binding: list-tail
#;3> (list-ref (string->list "hello") 1)
#\e
Finally, doing the same thing with the repl-max, I get correct results:
In the min.scm, library string-length is an alias to field1 which makes this pretty interesting. I would say that field1 is somehow not linked properly, but it's of course a primitive. Also, car and cdr work just fine.
Also of note that using -l max and compiling repl-min works just fine. I guess it's possible that I should have no expectation that this works, but figured I'd raise it anyway.
The text was updated successfully, but these errors were encountered:
Have been exploring ribbit a bit lately, and working on a Zig implementation (which will probably diverge a lot from this as I explore additions to the RVM). Anyway, in the midst of trying to understand the RVM decoding, I encountered the following on a fresh git clone:
As you can see,
string-ref
is in there, so the segfault is not occurring due to an unknown procedure or something (it would seem). Loading gdb:I'd try this with
min-tc
, which I suspect might provide more clues, but that doesn't exist.I did test the min defintions of
list-ref
andlist-tail
in chicken "just to be sure":Finally, doing the same thing with the repl-max, I get correct results:
In the min.scm, library
string-length
is an alias tofield1
which makes this pretty interesting. I would say thatfield1
is somehow not linked properly, but it's of course a primitive. Also,car
andcdr
work just fine.Also of note that using
-l max
and compiling repl-min works just fine. I guess it's possible that I should have no expectation that this works, but figured I'd raise it anyway.The text was updated successfully, but these errors were encountered: