History

tccpp.c: fix endless loop

Perhaps a better fix would be to ensure tok is set to TOK_EOF rather than 0 at the end of a macro stream. This partially fixes test2 of the examples given in: http://lists.nongnu.org/archive/html/tinycc-devel/2015-05/msg00002.html It's still failing, but at least it's not running out of memory now.

Philip committed 11 years ago

Commit a3d78b91 parent 1e878201 file · +3 −2Browse files

Unified · Split

tccpp.c+3−2
@@ -2930,8 +2930,9 @@ static int macro_subst_tok(TokenString *tok_str, · 2929 unmodified lines
29302930 /* NOTE: non zero sa->t indicates VA_ARGS */
29312931 while ((parlevel > 0 ||
29322932 (tok != ')' &&
2933− (tok != ',' || sa->type.t))) &&
2934− tok != -1) {
2933+ (tok != ',' || sa->type.t)))) {
2934+ if (tok == TOK_EOF || tok == 0)
2935+ break;
29352936 if (tok == '(')
29362937 parlevel++;
29372938 else if (tok == ')')

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t