Eric Schwartz wrote:
It's not a bug to be able to crash a Forth, since Forth gives you total control over the machine. Users are allowed to shoot themselves in the foot if they so choose, and that's pretty well documented.I was working on <URL:http://bugs.debian.org/140153>, when I discovered that adding the --enable-indirect-threaded flag to configure fixed the bug. Given that this is a PPC-only bug, does anybody have any idea what this flag does, and how, so that I can have more confidence that I didn't accidentally break something else by adding this flag to the Debian package?
Exactly what you would expect on a PPC, if you have --enable-direct-threaded. Then the execution token is a code address, which has to be 32-bit aligned. You've made it odd by subtracting one, and then tried to execute the code there.For full information, here's a transcript of the bug (again, this happens only on a powerpc machine):$ gforth : down ( x y -- x-1 y) compiled 1- compiled ; ok ' down ok .s <1> 806913952 ok 1- ok execute Segmentation fault
By the way, your stack comment for "down" is inconsistent with its definition. The topmost (most accessible) element is always on the right. A correct comment would be ( x -- x-1 ).
With --enable-indirect-threaded, the execution token is now the address of a code address. Subtracting one from it makes it the address of garbage. Maybe the garbage isn't quite so deformed as an odd instruction address, so you get a traceable exception?If I add --enable-indirect-threaded, the last bit becomes: execute *the terminal*:1: Invalid memory address execute ^^^^^^^ Backtrace: Which looks more correct (I am just learning forth, myself)
Anyway, both --enable-direct-threaded and --enable-indirect-threaded work fine on my PPC (a PowerMac). What you've described is not a gforth/PPC bug.
-- David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
