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: Sergey Korshunoff
Subject: Re: [Tinycc-devel] VLAs broken on mob branch
Date: Thu, 30 Apr 2015 15:36:27 +0300

> while(1) {
>    int *b = alloca(4);
> }
> will run out of memory eventually, while
No, at the begining of block we will restore a stack if we handle
alloca like VLA
Can you point to the standard for the alloca()? And what happens when
we leave a block?

> while(1) {
>    int b[function_returning_1()];
>    printf("%p\n", b);
> }
> mustn't run out of memory.
Proof? What happens if function_returning_1() will return (unsigned
long)(void *)-1 ?

A test for your first example:
int x = 4;
while(1) {
    int *b = alloca(4);
    int vla[x];
}
A stack will be restored, alloca() will NOT run out of memory.
Why a different semantic which depends on the context?



reply via email to

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