commit b054b416db6ea7150a34823cb898e45c42d5574c
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Mon Apr 11 16:52:23 2016 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Mon Apr 11 16:52:23 2016 +0200

    [cc2] Fix initialization of parser variables
    
    Curfun cannot be cleaned in endfun(), because then we lost the
    begin of the function for all the code generators. Inpars()
    was not correctly set, so any function could be loaded.

diff --git a/cc2/parser.c b/cc2/parser.c
index a02de01..39a777f 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -613,18 +613,13 @@ stmt(void)
 static void
 beginfun(void)
 {
-       inpars = 0;
+       inpars = 1;
        pushctx();
 }
 
 static void
 endfun(void)
 {
-       Node *np;
-
-       np = newnode();
-       curfun = NULL;
-       inpars = 0; /* I know, it is a bit redundant */
        endf = 1;
 }
 
@@ -634,7 +629,6 @@ parse(void)
        cleannodes();  /* remove code of previous function */
        popctx();  /* remove context of previous function */
        curfun = NULL;
-       endf = 0;
 
        while (!endf && nextline())
                /* nothing */;

Reply via email to