scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 75ea93d4e73b3984bc3d74550551b624e84cdf38
parent fde6f21d71a9c3786fa5f89275cbc017b87b0aa9
Author: Quentin Carbonneaux <quentin@c9x.me>
Date:   Fri, 20 Jan 2017 17:26:44 -0500

[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.

Diffstat:
Mcc2/arch/qbe/cgen.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -98,12 +98,15 @@ extern Type int32type, uint32type, ptrtype; static Node * tmpnode(Node *np, Type *tp) { + char flags; Symbol *sym; if (!np) 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;