prevent void foo () { if(0) {} class of segfaults

This commit is contained in:
Jeremiah Orians 2020-01-30 18:40:45 -05:00
parent 308b201fd4
commit 5c4c6aee71
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
3 changed files with 10 additions and 5 deletions

View File

@ -1085,6 +1085,7 @@ void process_if()
require_match("ERROR in process_if\nMISSING )\n", ")");
statement();
require(NULL != global_token, "Reached EOF inside of function\n");
if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @_END_IF_");
else if(X86 == Architecture) emit_out("JUMP %_END_IF_");
@ -1102,6 +1103,7 @@ void process_if()
global_token = global_token->next;
require(NULL != global_token, "Recieved EOF where an else statement expected\n");
statement();
require(NULL != global_token, "Reached EOF inside of function\n");
}
emit_out(":_END_IF_");
uniqueID_out(function->s, number_string);
@ -1171,6 +1173,7 @@ void process_for()
require_match("ERROR in process_for\nMISSING )\n", ")");
statement();
require(NULL != global_token, "Reached EOF inside of function\n");
if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @FOR_ITER_");
else if(X86 == Architecture) emit_out("JUMP %FOR_ITER_");
@ -1226,6 +1229,7 @@ void process_do()
global_token = global_token->next;
require(NULL != global_token, "Recieved EOF where do statement is expected\n");
statement();
require(NULL != global_token, "Reached EOF inside of function\n");
require_match("ERROR in process_do\nMISSING while\n", "while");
require_match("ERROR in process_do\nMISSING (\n", "(");
@ -1284,6 +1288,7 @@ void process_while()
require_match("ERROR in process_while\nMISSING )\n", ")");
statement();
require(NULL != global_token, "Reached EOF inside of function\n");
if((KNIGHT_POSIX == Architecture) || (KNIGHT_NATIVE == Architecture)) emit_out("JUMP @WHILE_");
else if(X86 == Architecture) emit_out("JUMP %WHILE_");

View File

@ -53,10 +53,10 @@ a0ae067746e7a2b01d33950da1cf640e12c3a70a045ab331ea2025af59dec9af test/results/t
1154f39f25dcd6d914e9a542306f95280926baf985d011b2152c7ea0b87ab42d test/results/test10-knight-native-binary
c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-binary
b3e13d54aab689137628fb9c4487bfd8288f9bd18bef8fe756577c8d2dce1f1f test/results/test10-x86-binary
61036eb3bc1b7039b5f6a240fb661728b57b0d16b641fa5f8d2740fe6b6e50e3 test/results/test100-amd64-binary
3987986885bfc3edb542b361b3f8d56f418b197f6974af2dcba320363faf24a6 test/results/test100-armv7l-binary
120233fe5773c21d83c40201cda4c858214593896919f62f42282cb5eb7b86e7 test/results/test100-knight-posix-binary
c7726290b1bd72e519da56e2a82a8fc11da22aecdd144e0498e7f2469c847649 test/results/test100-x86-binary
395269b9d4525c2be8da54db16d3a5874186e70c3623a18e6027ec88d5a82b59 test/results/test100-amd64-binary
c40d7ffcb22e7a6bfdfa8da047e73b2f7bfb24011f58ce79c5eea6f343ae2a32 test/results/test100-armv7l-binary
ac2be9c74cc0681ccf2b3413c84027233a63a7e733d740cd07cc3e51a2227008 test/results/test100-knight-posix-binary
e56280e3b896403a25791f189582195d7ad4d37654c2d30fba40e4505d2e8ea1 test/results/test100-x86-binary
34e6d535e30ef8826a4ad1a4d08b76cfa370c54595599ad3be784b64c9cd8ec5 test/results/test11-amd64-binary
893695e6f300a0fe055fad935a56abd549bba70d1d39c535a680f41bbb73f117 test/results/test11-armv7l-binary
955b564d2c89abf2cfc6c80d766cd11479d146b828dec69e654b0958a62d5e6e test/results/test11-knight-native-binary

View File

@ -1 +1 @@
c2e77ffce6bd293ef6f268626b7807dfbb05f0a8c17e9bd52f12c978a36fc830 test/test100/proof
b8a3169609d48a35a63fe7380f7de29a06ddc242a92475587cf78cc755cfb079 test/test100/proof