2020-07-13 15:12:30 +02:00
|
|
|
/* bug #1075 Internal compiler error */
|
|
|
|
|
2020-07-21 19:58:36 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2020-07-13 15:12:30 +02:00
|
|
|
long rhs;
|
|
|
|
|
2020-07-21 19:58:36 +02:00
|
|
|
int test(void)
|
2020-07-13 15:12:30 +02:00
|
|
|
{
|
2022-04-17 16:07:52 +02:00
|
|
|
/* the whole lhs is errorneously treated as an absolute address (integer
|
2020-07-13 15:12:30 +02:00
|
|
|
constant) neglecting its dereference */
|
|
|
|
return *(char *)0xD77C + rhs;
|
2020-07-21 19:58:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int res;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
memset(*(char *)0xD76C, 11, 0x80);
|
|
|
|
rhs = 0x10;
|
|
|
|
*(char *)(0xD77C + rhs) = 13;
|
|
|
|
*(char *)0xD77C = 23;
|
|
|
|
*(char *)0xD78C = 42;
|
|
|
|
res = test();
|
|
|
|
printf("res: %d\n", res);
|
|
|
|
if (res != (23 + 0x10)) {
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|