shithub: mc

Download patch

ref: 1b562ee700be25e69521691e72b73fdc5c887bfa
parent: e62508a51069116eeb35fee1e774794604dae8eb
author: Ori Bernstein <orib@google.com>
date: Fri Jul 20 14:23:01 EDT 2012

Don't overwrite the type of an expression.

--- a/8/simp.c
+++ b/8/simp.c
@@ -539,11 +539,12 @@
 {
     Node *t, *u, *r;
     Node **args;
+    Type *ty;
 
     args = n->expr.args;
-    if (n->expr.type->type == Typtr) {
+    ty = tybase(exprtype(args[0]));
+    if (ty->type == Typtr) {
         t = args[0];
-        t->expr.type = mktyptr(n->line, exprtype(n));
     } else {
         t = addr(args[0], exprtype(n));
     }
@@ -1166,6 +1167,7 @@
             lappend(fn, nfn, f);
         }
     } else {
+        dcl->decl.init = fold(dcl->decl.init);
         if (dcl->decl.init && exprop(dcl->decl.init) == Olit)
             lappend(&s.blobs, &s.nblobs, dcl);
         /* uninitialized global vars get zero-initialized decls */