Open Daniel-Cortez opened 3 years ago
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);
}
Exception thrown at 0x77A0FF05 (ntdll.dll) in pawncc.exe: 0xC0000005: Access violation writing location 0x000000B8.
I can't see why, looking at the change, but it was definitely introduced by 3e0c5ba9c0ae9ff3c86269010237c356d6bbd1fc
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 POPSTK_I
here:
This caused corruption of the value stack, would only happen when the control expression in if
, while
, do..while
, for
, assert
or state
results in a constant value, which is pretty rare as normally the compiler warns about this. In your case it was assert(false)
in YSI_Players\y_groups\y_groups_entry
.
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). Functiontest()
(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: