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: Wed, 29 Apr 2015 08:51:13 +0000

I don't think we need to change anything to get GCC behaviour, in that
case. alloca() doesn't need to call vla_sp_save because it has
different semantics from VLAs:

while(1) {
    int *b = alloca(4);
}

will run out of memory eventually, while

while(1) {
    int b[function_returning_1()];
    printf("%p\n", b);
}

mustn't run out of memory. So, no, we shouldn't handle VLAs and
alloca() the same, because that would generate incorrect code in cases
like this:

int *p;
if (1) {
    p = alloca(4);
}
*p = 0;


About the simplification patch: yes, it's specific to x86_64, should
have mentioned that. Fixed version attached.

(I've also started using the personal mob area at
http://repo.or.cz/w/tinycc.git/shortlog/refs/mob/mob_pipcet/simple-vlas,
which I think you can clone with

    git config --add remote.origin.fetch
'+refs/mob/mob_pipcet/*:refs/remotes/origin/mob_pipcet/*'
    git checkout origin/mob_pipcet/simple-vlas

I'm currently merging some of my other changes and they'll show up as
branches in that repository, if all goes well. Feel free to have a
look if you're curious.)

On Wed, Apr 29, 2015 at 5:05 AM, Sergey Korshunoff <address@hidden> wrote:
>> handle alloca like VLA regarding SP save/restore
> method 1: perform a call to the val_sp_save() analog from the alloca()
> method 2: define a built function alloca, which replace a call to the
> alloca with the VLA    declaration. Is alloca*.S  needed in such case?
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Attachment: tcc-simple-vlas-002.diff
Description: Text document


reply via email to

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