Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions source/compiler/sc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -5972,6 +5972,7 @@ static int test(int label,int parens,int invert)
cell cidx;
int ident,tag;
int endtok;
short save_intest;
cell constval;
symbol *sym;
int localstaging=FALSE;
Expand All @@ -5985,7 +5986,7 @@ static int test(int label,int parens,int invert)
#endif
} /* if */

PUSHSTK_I(sc_intest);
save_intest=sc_intest;
sc_intest=TRUE;
endtok=0;
if (parens!=TEST_PLAIN) {
Expand Down Expand Up @@ -6016,7 +6017,7 @@ static int test(int label,int parens,int invert)
} /* if */
if (ident==iCONSTEXPR) { /* constant expression */
int testtype=0;
sc_intest=(short)POPSTK_I();/* restore stack */
sc_intest=save_intest; /* restore stack */
stgdel(index,cidx);
if (constval) { /* code always executed */
error(206); /* redundant test: always non-zero */
Expand All @@ -6039,7 +6040,7 @@ static int test(int label,int parens,int invert)
else
jmp_eq0(label); /* jump to label if false (equal to 0) */
markexpr(sEXPR,NULL,0); /* end expression (give optimizer a chance) */
sc_intest=(short)POPSTK_I(); /* double typecast to avoid warning with Microsoft C */
sc_intest=save_intest;
if (localstaging) {
stgout(0); /* output queue from the very beginning (see
* assert() when localstaging is set to TRUE) */
Expand Down
7 changes: 7 additions & 0 deletions source/compiler/tests/incomplete_dowhile_crash.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
'test_type': 'output_check',
'errors': """
incomplete_dowhile_crash.pwn(6) : error 001: expected token: "while", but found "}"
incomplete_dowhile_crash.pwn(7) : error 001: expected token: ";", but found "-end of file-"
"""
}
6 changes: 6 additions & 0 deletions source/compiler/tests/incomplete_dowhile_crash.pwn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma option -;+

main()
{
do {}
}