Skip to content
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

Ambiguous condition with , in core.fr #18

Closed
jamesbowman opened this issue Feb 14, 2016 · 2 comments
Closed

Ambiguous condition with , in core.fr #18

jamesbowman opened this issue Feb 14, 2016 · 2 comments

Comments

@jamesbowman
Copy link
Collaborator

Looking at this sequence:

https://github.com/gerryjackson/forth2012-test-suite/blob/master/src/core.fr#L548-L556

then there is no guarantee that the data-space pointer will be aligned when executing ,. Many Forths implemement CONSTANT using CREATE which would hide this issue.

http://forth.sourceforge.net/std/dpans/dpans6.htm#6.1.0150

"... An ambiguous condition exists if the data-space pointer is not aligned prior to execution of ,."
@jamesbowman jamesbowman changed the title Undefined behavior with , in core.fr Ambiguous condition with , in core.fr Feb 15, 2016
@gerryjackson
Copy link
Owner

You're correct and well spotted. Its only been in core.fr for over 20 years!

We have to make sure that dataspace is aligned before testing , and since CREATE isn't tested until later we should test ALIGN and ALIGNED first.

I see that CONSTANT isn't tested until later (line 735) but is well used before, as early as line 40. I should probably add CONSTANT to the words given a simple test in prelim.fth.

Also I see that there is a comment that negative ALLOT needs to be tested. We might as well add that while we're about it.

I'll think about it later when I've a bit more time.

@gerryjackson
Copy link
Owner

Sorry, I forgot about this issue until I updated something else. I have added a test for ALIGN and ALIGNED and used ALIGN just before the test for , (comma).

As CONSTANT is used quite often in core.fr before being tested I have added a simple test for CONSTANT in prelimtest.fth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants