ref: 84ef54ce07723eddf2f17a5fb9d959fc31c77100
parent: d23527d9b83c725a054a56fe7f5d956c485129df
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Nov 15 16:38:51 EST 2021
cc1: Avoid non symbol nodes in foldcast() Foldcast() expects that the left child is a constant node with a constant symbol. There are some cases where some constant nodes are not going to have associated a constant symbol, like for example the case of the address of a static variable.
--- a/src/cmd/cc/cc1/fold.c
+++ b/src/cmd/cc/cc1/fold.c
@@ -321,7 +321,7 @@
Type *newtp = np->type, *oldtp = l->type;
Symbol aux, *sym, *osym = l->sym;
- if ((l->flags & NCONST) == 0)
+ if ((l->flags & NCONST) == 0 || !osym)
return np;
switch (newtp->op) {