> Let's go for correctness over performance for now and apply change 4?

Let's compare a tcc with all patches added and gcc. A test program
(some modification of your):

#include <stdio.h>
int main(int argc)
{
  unsigned long our_sp;
  int c = 3;

  while (c--) {
    char test[argc];
    __asm__ ("\t movl %%esp,%0" : "=r"(our_sp));
    fprintf(stderr,"1: SP=%p\n", (void *)our_sp);

    char test2[argc]; // 2'd VLA
    __asm__ ("\t movl %%esp,%0" : "=r"(our_sp));
    fprintf(stderr,"2: SP=%p\n", (void *)our_sp);

    char test3[argc]; // 3'd VLA
    __asm__ ("\t movl %%esp,%0" : "=r"(our_sp));
    fprintf(stderr,"3: SP=%p\n", (void *)our_sp);

    if(0)
      label:
       continue;

    goto label;
  }
}

Output of the gcc program:
1: SP=0xbfc26d40
2: SP=0xbfc26d30
3: SP=0xbfc26d20
1: SP=0xbfc26d40
2: SP=0xbfc26d30
3: SP=0xbfc26d20
1: SP=0xbfc26d40
2: SP=0xbfc26d30
3: SP=0xbfc26d20

Output of the tcc program:
1: SP=0xbfeb1dd0
2: SP=0xbfeb1dc0
3: SP=0xbfeb1db0
1: SP=0xbfeb1dc0
2: SP=0xbfeb1db0
3: SP=0xbfeb1da0
1: SP=0xbfeb1db0
2: SP=0xbfeb1da0
3: SP=0xbfeb1d90

Additional vla_sp_save() is not a solution.
if we add '{' after if(0) then there is no a "boom" even w/o
additional vla_sp_save().
But the output is the same (wrong).

PS: I need to test tcc w/o all new patches.

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to