commit 52f26ada8dedab3823cf9dc42625391830bf9619
Author:     Roberto E. Vargas Caballero <k...@shike2.com>
AuthorDate: Tue Jul 12 15:50:27 2016 +0200
Commit:     Roberto E. Vargas Caballero <k...@shike2.com>
CommitDate: Tue Jul 12 15:50:27 2016 +0200

    [cc2] Fix case of return without expression
    
    eval is no longer detecting if the input token
    is null, and in the case of return this
    situation can happen, and it has happening.

diff --git a/cc2/parser.c b/cc2/parser.c
index fa1eae0..5a6d3f7 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -329,7 +329,9 @@ oreturn(char *token, union tokenop u)
 {
        Node *np = newnode(u.op);
 
-       eval(strtok(NULL, "\t\n"));
+       token = strtok(NULL, "\t\n");
+       if (token)
+               eval(strtok(NULL, "\t\n"));
        if (!empty())
                np->left = pop();
        push(np);

Reply via email to