ref: 4462308d95e9aede0ea42f4262bb082007beb427
parent: d24e07c3b0d27cb74123830b22e6c58456b7fca4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Nov 5 17:43:14 EDT 2021
cc2: Add array flag When an array is loaded we have to do nothing, because an array is loaded using only its address (like it was already donde for aggregates).
--- a/src/cmd/cc/cc2/cc2.h
+++ b/src/cmd/cc/cc2/cc2.h
@@ -12,6 +12,7 @@
PARF = 1 << 6, /* parameter */
INITF = 1 << 7, /* initializer flag */
ELLIPS = 1 << 8, /* vararg function */
+ ARRF = 1 << 9, /* array flag */
};
enum sclass {
--- a/src/cmd/cc/cc2/parser.c
+++ b/src/cmd/cc/cc2/parser.c
@@ -571,6 +571,7 @@
size = pop();
base = pop();
tp = pop();
+ tp->flags = ARRF;
tp->size = size->u.i * base->size; /* FIXME check for overflow */
tp->align = base->align;
--- a/src/cmd/cc/cc2/target/qbe/cgen.c
+++ b/src/cmd/cc/cc2/target/qbe/cgen.c
@@ -102,7 +102,7 @@
Node *new;
int flags = tp->flags;
- if (flags & (AGGRF|FUNF))
+ if (flags & (AGGRF|FUNF|ARRF))
return np;
switch (tp->size) {