[hackers] [scc] [cc2-qbe] Do not copy meaningless flags in tmpnode() || Quentin Carbonneaux

From: <git_AT_suckless.org>
Date: Sat, 21 Jan 2017 09:45:44 +0100 (CET)

commit 75ea93d4e73b3984bc3d74550551b624e84cdf38
Author: Quentin Carbonneaux <quentin_AT_c9x.me>
AuthorDate: Fri Jan 20 17:26:44 2017 -0500
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Jan 21 09:41:34 2017 +0100

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

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index f493ca0..8900c6b 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -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;
Received on Sat Jan 21 2017 - 09:45:44 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 21 2017 - 09:48:18 CET