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

Stack misalignment bug #3085

Open
nuggreat opened this issue Apr 24, 2023 · 3 comments
Open

Stack misalignment bug #3085

nuggreat opened this issue Apr 24, 2023 · 3 comments
Milestone

Comments

@nuggreat
Copy link

Running a script from a function declared in the terminal appears to cause a stack misalignment bug.

Steps to reproduce

  1. Make a script called "stack" with the code print "stack"..
  2. In the terminal type FUNCTION foo { print "foo1". run stack. print "foo2". }
  3. Call foo from the terminal this will trigger the stack error once foo has finished execution.

All prints will occur successfully and it appears that the error only happens once foo() is returning. None of the prints where required to cause the error and where only included to try to get an idea where the error occurred in execution.

The exact error kOS prints is the "Number of arguments passed in didn't match the number of DECLARED PARAMETERs" with the verbose text of "something is wrong with the stack - no arg bottom mark when doing a return"

@darthgently
Copy link

darthgently commented Apr 24, 2023

Could stack being a reserved word and data structure name be confounding the test? Maybe try renaming the script to bar to rule it out or in

@nuggreat
Copy link
Author

The script would not have run if this was a reserved word conflict. What is happening is that run is actually RUNPATH() in a funny hat so RUN stack. is effectively getting converted into RUNPATH("stack"). by the compiler which won't conflict with any reserved words because that isn't something strings do. I would have expected if there was a reserved word conflict that got past the compile time check for those I would have seen a type mismatch error instead as apposed to stack misalignment. Also this is me simply reproducing and then making an issue about an error that others had that they didn't create an issue about them selves and they used different names for everything in there case with the exact same results as seen here.

@darthgently
Copy link

Understood. It was the idea of the bare word stack being seen by a parser that has surprised us in what it is actually doing that caught my eye.

@JonnyOThan JonnyOThan added this to the 1.5.0.0 milestone Aug 4, 2024
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

3 participants