I need advise before I submit pathc to fix the test gcc-torture/execute/vla-dealloc-1.c (attached below)

The test appears to be unsafe. The original fault was failure to deallocate VLA on the jump - thus with the fault present the test would appear to perform 1 million new allocation - and fail presumably due to either execution time or run time error - neither of which seem certian.

I have to modify the test since it presumes 32bit or larger integers - and thus on 16bit targets overflowing into -ve allocations make it somewhat undefined behavior. It take rather a long time to execute - way more than other execution tests and trips timeout limit for AVR simulator tests.

a) I could disable test for target without 32bit integers
b) I could change n to be 32 bit on 16 bit targets (the test will then be equally uncertain on 16 bit targets at detecting fault.) c) I could reduce "n" to 10,000 - but that likely will create more false positives

a) is my easy way out - but perhaps I should address the apparent weakness where the test could pass with the original problem present?

Suggestions?



/* VLAs should be deallocated on a jump to before their definition,
  including a jump to a label in an inner scope.  PR 19771.  */

void *volatile p;

int
main (void)
{
 int n = 0;
 if (0)
   {
   lab:;
   }
 int x[n % 1000 + 1];
 x[0] = 1;
 x[n % 1000] = 2;
 p = x;
 n++;
 if (n < 1000000)
   goto lab;
 return 0;
}

Reply via email to