-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault in pfCatch (XT=2536) at ../../csrc/pf_inner.c:335 #6
Comments
First of all, Why do you use old system.fth? pforth should compile nicely with current system.fth. Second the segfault comes from 0BRANCH in definition of IF which is same in both. With quick look I can't see differences. |
I tried to compile V21 from Debian on ARM64 and it segfaulted. So I searched and saw that V27 is available. This compiled and worked fine on ARM64. For some reason, I tried V27 with the V21 system.fth and received the segfault, which I reproduced on x86_64. What I did may not make much sense, but there should never be a segfault, so I reported it. I hope that explains it. I don't know anything about pforth. I was just looking for packages in Debian that were not available on ARM64 yet. |
Hello tbm, thanks for reporting this.
There were quite a few changes between V21 and V27, including support for 64-bit operation. I think the segfault was probably due to 32 vs 64-bit pointer mismatch caused by version skew.
Well, maybe. If I wrote a pure Java program and got a segfault then I would say there was a bug in the compiler. A Java program should never segfault. But Forth is an unruly beast with no separation between the compiler, the run-time, and the user program. A segfault caused by version skew involving system.fth is not unexpected.. |
I found the problems. Just for the record: First are cell and cells. Both are now in C side. Second change was in does> to add >R and R> around [comile] ; That way it compiled. I didn't test any further. |
You are welcome to try and get files from different versions to work together. But they are not intended to be mixed. We recommend using all files from the same version of pForth. |
Using current pforth from github and the system.fth file from Debian's pforth package (which is at V21), I get a segfault. I put the system.fth file here: http://www.cyrius.com/tmp/system.fth
Starting program: /home/tbm/pforth-21/a/pforth/build/unix/pforth -i ../../../../system.fth
PForth V27-LE/64, built Jul 9 2015 16:56:37
Including: ../../../../system.fth
CELL redefined.
CELLS redefined.
Program received signal SIGSEGV, Segmentation fault.
0x0000000000402090 in pfCatch (XT=2536) at ../../csrc/pf_inner.c:335
335 Token = READ_CELL_DIC(InsPtr++);
(gdb) where
#0 0x0000000000402090 in pfCatch (XT=2536) at ../../csrc/pf_inner.c:335
#1 0x00000000004095d5 in FindAndCompile (theWord=0x60eac0 "\a0BRANCHIG L PRIMITIVESILING ", '-' <repeats 40 times>, "*")
#2 0x00000000004097f6 in ffInterpret () at ../../csrc/pfcompil.c:849
#3 0x000000000040994f in ffOuterInterpreterLoop () at ../../csrc/pfcompil.c:919
#4 0x00000000004099a1 in ffIncludeFile (InputFile=0x62f790) at ../../csrc/pfcompil.c:942
#5 0x0000000000401bcd in pfIncludeFile (FileName=0x7fffffffecad "../../../../system.fth") at ../../csrc/pf_core.c:373
#6 0x0000000000401e8d in pfDoForth (DicFileName=0x0, SourceName=0x7fffffffecad "../../../../system.fth", IfInit=1) at ../../csrc/pf_core.c:550
#7 0x000000000040579e in main (argc=3, argv=0x7fffffffea28) at ../../csrc/pf_main.c:140
(gdb)
The text was updated successfully, but these errors were encountered: