[hackers] [scc] Convert empry inirializers to the correct type || Roberto E. Vargas Caballero
commit fbd7247cc8cf0a6829d6a9a1e7e9f26f30e4005d
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Jan 19 15:38:53 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Jan 19 15:38:53 2016 +0100
Convert empry inirializers to the correct type
zero has integer type, and it is not what we always want.
diff --git a/cc1/code.c b/cc1/code.c
index 0b694c7..8051282 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -328,9 +328,10 @@ emitdesig(Node *np, Type *tp)
case PTR:
case INT:
case ENUM:
- aux = (sym) ? *sym->u.init : constnode(zero);
+ aux = (sym) ? *sym->u.init : convert(constnode(zero), tp, 0);
emitexp(OEXPR, aux);
break;
+ /* TODO: case UNION: */
case STRUCT:
case ARY:
for (n = 0; n < tp->n.elem; ++n) {
_AT_@ -339,10 +340,13 @@ emitdesig(Node *np, Type *tp)
}
break;
default:
- /* TODO: Handle other kind of constants */
abort();
}
+ if (sym) {
+ free(sym->u.init);
+ sym->u.init = NULL;
+ }
freetree(np);
return;
Received on Tue Jan 19 2016 - 15:40:04 CET
This archive was generated by hypermail 2.3.0
: Tue Jan 19 2016 - 15:48:35 CET