tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] VLAs broken on mob branch


From: Pip Cet
Subject: Re: [Tinycc-devel] VLAs broken on mob branch
Date: Sat, 25 Apr 2015 07:48:47 +0000

Hi,
thanks for your response!

On Sat, Apr 25, 2015 at 4:39 AM, Sergey Korshunoff <address@hidden> wrote:
> Hi,
> on x86 Linux a similar patch of the gfunc_call (i386-gen.c) leads to
> the hang on the test3.

That's good to know.

> It looks that
>
> @@ -5458,6 +5459,7 @@ static void decl_initializer(CType *type,
> Section *sec, unsigned long c,
>
>          vla_runtime_type_size(type, &a);
>          gen_vla_alloc(type, a);
> +        vla_sp_save();
>          vset(type, VT_LOCAL|VT_LVAL, c);
>          vswap();
>          vstore();
>
> is enough to fix a problem.

That doesn't appear to fix the problem for me (on x86_64), without the
other changes. Are you sure it's sufficient for you?

>  All other changes are to simplify a code.

I don't think that's true. There are four changes:

 - use n rather than loc in post_type(). On another branch I'm working
on, this change is necessary, though on the mob branch I haven't been
able to trigger this bug. But it is a bug! gen_op('*') can trigger a
save_regs() which changes loc after n is set.
 - always restore vla_sp_loc to saved_vla_sp_loc in block(). Since
vla_sp_loc is a global variable, it might have changed, so this is not
just a simplification. Note that saved_vla_sp_loc and orig_vla_sp_loc
are sometimes different. And I definitely need this change to avoid
the segfault.
 - introduce orig_vla_sp_loc. This is a pure simplification, as far as
I can tell.
 - the extra call to vla_sp_save() in decl_initializer(). That appears
to be necessary to fix the segfault, too.

I'm tempted to commit 1, 2, and 3, at least, but I don't fully understand 4.

Thanks again.



reply via email to

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