ref: 3264efeca8c41b909a8fca2c57785f936fb55f80
parent: c946d13235a8460a8c7f2aa86e705202d77231a7
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Jun 18 02:35:40 EDT 2022
cc1: Add debug information about decay Applying decay can heavily modify the behaviour of some expressions.
--- a/src/cmd/cc/cc1/code.c
+++ b/src/cmd/cc/cc1/code.c
@@ -578,5 +578,6 @@
sym = newsym(NS_IDEN, NULL);
sym->type = sizettype;
sym->u.i = tp->size;
+ DBG("EXPR sizeof %llu", sym->u.i);
return constnode(sym);
}
--- a/src/cmd/cc/cc1/expr.c
+++ b/src/cmd/cc/cc1/expr.c
@@ -194,6 +194,7 @@
switch (tp->op) {
case ARY:
+ DBG("EXPR decay ary");
tp = tp->type;
if (np->op == OPTR) {
new = np->left;
@@ -201,14 +202,18 @@
new->type = mktype(tp, PTR, 0, NULL);
return new;
}
+ break;
case FTN:
- new = node(OADDR, mktype(tp, PTR, 0, NULL), np, NULL);
- if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
- new->flags |= NCONST;
- return new;
+ DBG("EXPR decay function");
+ break;
default:
return np;
}
+
+ new = node(OADDR, mktype(tp, PTR, 0, NULL), np, NULL);
+ if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
+ new->flags |= NCONST;
+ return new;
}
static Node *