VLA fix [1/3]: added testcase demonstrating VLA bug
This commit is contained in:
@ -2079,9 +2079,14 @@ void *bounds_checking_is_enabled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void c99_vla_test(int size1, int size2)
|
void c99_vla_test(int size1, int size2)
|
||||||
{
|
{
|
||||||
|
#if defined __i386__ || defined __x86_64__
|
||||||
int size = size1 * size2;
|
int size = size1 * size2;
|
||||||
int tab1[size][2], tab2[10][2];
|
int tab1[size][2], tab2[10][2];
|
||||||
|
void *tab1_ptr, *tab2_ptr, *bad_ptr;
|
||||||
|
|
||||||
|
/* "size" should have been 'captured' at tab1 declaration,
|
||||||
|
so modifying it should have no effect on VLA behaviour. */
|
||||||
size = size-1;
|
size = size-1;
|
||||||
|
|
||||||
printf("Test C99 VLA 1 (sizeof): ");
|
printf("Test C99 VLA 1 (sizeof): ");
|
||||||
|
|||||||
Reference in New Issue
Block a user