tccgen: 32bits: fix PTR +/- long long
Previously in order to perform a ll+ll operation tcc
was trying to 'lexpand' PTR in gen_opl which did
not work well. The case:
int printf(const char *, ...);
char t[] = "012345678";
int main(void)
{
char *data = t;
unsigned long long r = 4;
unsigned a = 5;
unsigned long long b = 12;
*(unsigned*)(data + r) += a - b;
printf("data %s\n", data);
return 0;
}
This commit is contained in:
15
tests/tests2/87_ptr_longlong_arith32.c
Normal file
15
tests/tests2/87_ptr_longlong_arith32.c
Normal file
@ -0,0 +1,15 @@
|
||||
int printf(const char *, ...);
|
||||
char t[] = "012345678";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char *data = t;
|
||||
unsigned long long r = 4;
|
||||
unsigned a = 5;
|
||||
unsigned long long b = 12;
|
||||
|
||||
*(unsigned*)(data + r) += a - b;
|
||||
|
||||
printf("data = \"%s\"\n", data);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user