ref: 72415218413b75d436592eab0963a84a27e7974d
parent: 3272d1353b0c12caafed7986c710c9e76f3e68e1
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Aug 9 10:09:29 EDT 2016
[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.
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -494,10 +494,9 @@
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 @@
np = node(op, np->type->type, np, NULL);
}
np->flags |= NLVAL;
- return np;
- default:
- error("invalid argument of memory indirection");
}
+ return np;
}
static Node *