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) --- i386-gen.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'i386-gen.c') diff --git a/i386-gen.c b/i386-gen.c index 79087d0..b96e4fb 100644 --- a/i386-gen.c +++ b/i386-gen.c @@ -848,6 +848,8 @@ ST_FUNC void gen_opi(int op) fr = vtop[0].r; vtop--; save_reg(TREG_EDX); + /* save EAX too if used otherwise */ + save_reg_upstack(TREG_EAX, 1); if (op == TOK_UMULL) { o(0xf7); /* mul fr */ o(0xe0 + fr); -- cgit v1.3.1