From b691585785086024549cfb9ac65f3397263965aa Mon Sep 17 00:00:00 2001 From: grischka Date: Tue, 4 Oct 2016 17:36:51 +0200 Subject: tccgen: arm/i386: save_reg_upstack tccgen.c:gv() when loading long long from lvalue, before was saving all registers which caused problems in the arm function call register parameter preparation, as with void foo(long long y, int x); int main(void) { unsigned int *xx[1], x; unsigned long long *yy[1], y; foo(**yy, **xx); return 0; } Now only the modified register is saved if necessary, as in this case where it is used to store the result of the post-inc: long long *p, v, **pp; v = 1; p = &v; p[0]++; printf("another long long spill test : %lld\n", *p); i386-gen.c : - found a similar problem with TOK_UMULL caused by the vstack juggle in tccgen:gen_opl() (bug seen only when using EBX as 4th register) --- tests/tcctest.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/tcctest.c b/tests/tcctest.c index 5e9b07f..e55dc05 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -1953,6 +1953,11 @@ long long int value(struct S *v) return ((long long int)v->item); } +long long llfunc2(long long x, long long y, int z) +{ + return x * y * z; +} + void longlong_test(void) { long long a, b, c; @@ -1999,15 +2004,17 @@ void longlong_test(void) } lloptest(0x80000000, 0); - /* another long long spill test */ { - long long *p, v; + long long *p, v, **pp; v = 1; p = &v; p[0]++; - printf("%lld\n", *p); - } + printf("another long long spill test : %lld\n", *p); + pp = &p; + v = llfunc2(**pp, **pp, ia); + printf("a long long function (arm-)reg-args test : %lld\n", v); + } a = 68719476720LL; b = 4294967295LL; printf("%d %d %d %d\n", a > b, a < b, a >= b, a <= b); -- cgit v1.3.1