diff options
| author | grischka <grischka> | 2016-10-13 19:21:43 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2016-10-13 19:21:43 +0200 |
| commit | ed15cddacd145c74e4600af50f6616ba59ca0d8d (patch) | |
| tree | fd1a7a73ace9aadd3ad9f0a6b60ccb084c090813 /tests | |
| parent | 8986bc8af473080bed0efa01cb569f3e25f179a9 (diff) | |
| download | tinycc-ed15cddacd145c74e4600af50f6616ba59ca0d8d.tar.gz tinycc-ed15cddacd145c74e4600af50f6616ba59ca0d8d.tar.bz2 | |
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;
}
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tests2/87_ptr_longlong_arith32.c | 15 | ||||
| -rw-r--r-- | tests/tests2/87_ptr_longlong_arith32.expect | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/tests2/87_ptr_longlong_arith32.c b/tests/tests2/87_ptr_longlong_arith32.c new file mode 100644 index 0000000..bf07915 --- /dev/null +++ b/tests/tests2/87_ptr_longlong_arith32.c @@ -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; +} diff --git a/tests/tests2/87_ptr_longlong_arith32.expect b/tests/tests2/87_ptr_longlong_arith32.expect new file mode 100644 index 0000000..f91e4b4 --- /dev/null +++ b/tests/tests2/87_ptr_longlong_arith32.expect @@ -0,0 +1 @@ +data = "0123-5678" |
