[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Zeroing stack variables CValue

From: Michael Matz
Subject: Re: [Tinycc-devel] Zeroing stack variables CValue
Date: Sun, 30 Mar 2014 01:19:03 +0100 (CET)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)


On Sat, 29 Mar 2014, Domingo Alvarez Duarte wrote:

Ok now I understand your point, here is the minimal program that I was using
to trace it:
int main() {
int x;
static void *label_return = &&lbl_return;
//printf("label_return = %p\n", label_return);
goto *label_return; //<<<<< here segfault on linux X86_64 without the memset
on vsetĀ 
return 0;

Thanks. While it doesn't crash for me on x86-64 (with rev aa561d70, i.e. before your memset patch) I do see the wrong vset flowing into init_putv; it's unary(), case TOK_LAND, which does

        vset(&s->type, VT_CONST | VT_SYM, 0);
        vtop->sym = s;

Where s->type will be VT_PTR. Indeed vset as it is right now cannot be used to initialize values of such type. One could extend vset (together with vpush64 the only routine that accepts an arbitrary type but sets a specific CValue member) to check for the type and initialize the correct member. Possibly it's better to try to get rid of as many explicit vset calls as possible (many of the current ones actually don't need the immediate value, as it's always zero, and those others that actually pass some offset or location seem mostly dubious in that they might incorrectly truncate the value while passing it to vset). Needs some pondering ...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]