test for issue #1077
This commit is contained in:
parent
4b8b15a07a
commit
5925a7f8ee
1 changed files with 31 additions and 0 deletions
31
test/todo/bug1077.c
Normal file
31
test/todo/bug1077.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* bug #1077 - Wrong code: a non-array constant address with a non-constant subscript */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int test1(void)
|
||||
{
|
||||
int a = 0;
|
||||
(&a)[a] = 42;
|
||||
return a;
|
||||
}
|
||||
int test2(void)
|
||||
{
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
(&a)[b] = 42;
|
||||
return a;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int res, ret = EXIT_SUCCESS;
|
||||
res = test1();
|
||||
printf("%d\n", res);
|
||||
if (res != 42) ret = EXIT_FAILURE;
|
||||
res = test2();
|
||||
printf("%d\n", res);
|
||||
if (res != 42) ret = EXIT_FAILURE;
|
||||
|
||||
return ret;
|
||||
}
|
Loading…
Add table
Reference in a new issue