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: Tue, 28 Apr 2015 08:19:08 +0000

Oh, I see. You're right, that's another bug in the old code, but easy
enough to fix. Here's the fixed patch and a test case.

If you want to optimize things, it would be great if we wouldn't end
up storing each VLA pointer twice—having it on the stack once should
be enough. I think we should be able to get away with simply setting
*vla_sp_loc to c in the initializers...

On Tue, Apr 28, 2015 at 6:52 AM, Sergey Korshunoff <address@hidden> wrote:
> Hi, Philip! A nice work :-)
>
>> PS: patch 4 can be wrong for the case of the multiple VLA declaration
>> As I understand, SP will be saved only after vla1.
>
> Let's continue. Testing a current mob tcc with 1..4 patches added.
> A test program:
>
> void test2()
> {
>   unsigned long our_sp;
>   int count = 10;
>   void *addr[count];
>   void *addr2[count];
>   void *addr3[count];
>
>     __asm__ ("\t movl %%esp,%0" : "=m"(our_sp));
>     fprintf(stderr,"1: SP=%p\n", (void *)our_sp);
>
>   for(;count--;) {
>     int a[f()];
>
>     addr[count] = a;
>
>     continue;
>   }
>
>     __asm__ ("\t movl %%esp,%0" : "=m"(our_sp));
>     fprintf(stderr,"2: SP=%p\n", (void *)our_sp);
>
>   if(addr[9] == addr[0]) {
>     printf("OK\n");
>   } else {
>     printf("NOT OK\n");
>   }
> }
>
> A test compiled by gcc:
> 1: SP=0xbf896260
> 2: SP=0xbf896260
> OK
>
> A test compiled by tcc:
> 1: SP=0xbff62dc0
> 2: SP=0xbff62e20
> OK
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Attachment: tcc-notafix-002.diff
Description: Text document


reply via email to

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