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
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to