shithub: scc

Download patch

ref: cff9d9445f468ca015886faedfd8cbd686f24724
parent: cf0d2db50fd6968c52a682e3bf9e749a7b89074b
author: Quentin Carbonneaux <quentin@c9x.me>
date: Fri Jan 20 12:26:44 EST 2017

[cc2-qbe] Do not copy meaningless flags in tmpnode()

These flags can create problems in some places, for example
with arguments:

	int f(unsigned long l) { return l; }

the returned value is included in the list of arguments.

--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -98,6 +98,7 @@
 static Node *
 tmpnode(Node *np, Type *tp)
 {
+	char flags;
 	Symbol *sym;
 
 	if (!np)
@@ -104,6 +105,8 @@
 		np = newnode(OTMP);
 	sym = getsym(TMPSYM);
 	sym->type = np->type = *tp;
+	flags = tp->flags & ~(PARF|INITF);
+	sym->type.flags = np->type.flags = flags;
 	sym->kind = STMP;
 	np->left = np->right = NULL;
 	np->u.sym = sym;