-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fix crash from an incomplete do-while
statement
#680
base: dev
Are you sure you want to change the base?
Conversation
This issue has been automatically marked as stale because it has not had recent activity. |
Merged locally. |
I get an access violation here after merging this PR: /* pc_readsrc()
* Reads a single line from the source file (or up to a maximum number of
* characters if the line in the input file is too long).
*/
char *pc_readsrc(void *handle,unsigned char *target,int maxchars)
{
return fgets((char*)target,maxchars,(FILE*)handle);
}
I can't see why, looking at the change, but it was definitely introduced by 3e0c5ba |
When compiling the YSI test script: https://github.com/pawn-lang/YSI/blob/master/gamemodes/YSI_TEST.pwn |
My bad, it seems I forgot to replace the use of This caused corruption of the value stack, would only happen when the control expression in |
OK, now it should be fixed, both here and in #681. Not sure if I should add a separate test for this, as the case seems to be very specific. |
What this PR does / why we need it:
Fixes the compiler crash from an incomplete
do-while
statement without thewhile (...);
part (see #678).Function
test()
(filesc1.c
) was saving and restoring the previous value ofsc_intest
throughPUSHSTK_I()/POPSTK_I()
, and this was preventing the compiler from stopping the compilation process when the end of file was reached before closing thedo-while
statement. Making the function save/restore the value ofsc_intest
using the actual stack (by saving the value into a local variable) fixes the issue.Which issue(s) this PR fixes:
Fixes #678
What kind of pull this is:
Additional Documentation: