commit 058e5104f68f1a0d1a0da305c7e730b2d5adb392
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Tue Aug 9 14:09:29 2016 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Tue Aug 9 14:09:29 2016 +0200

    [cc1] Fix content()
    
    With previous version of the code content() had no problems
    receiving something different to a pointer, but, with the current
    this is not true anymore. If we receive an array then it means
    that we have a problem somewhere.

diff --git a/cc1/expr.c b/cc1/expr.c
index 21af200..138ad48 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -494,10 +494,9 @@ free_np:
 static Node *
 content(char op, Node *np)
 {
-       switch (BTYPE(np)) {
-       case ARY:
-       case FTN:
-       case PTR:
+       if (BTYPE(np) != PTR) {
+               errorp("invalid argument of memory indirection");
+       } else {
                if (np->op == OADDR) {
                        Node *new = np->left;
                        new->type = np->type->type;
@@ -507,10 +506,8 @@ content(char op, Node *np)
                        np = node(op, np->type->type, np, NULL);
                }
                np->flags |= NLVAL;
-               return np;
-       default:
-               error("invalid argument of memory indirection");
        }
+       return np;
 }
 
 static Node *

Reply via email to