|
From: | grischka |
Subject: | Re: [Tinycc-devel] Questions about commit 5b28165: Fix test 131 for 32 bits targets |
Date: | Fri, 7 Jul 2023 19:25:50 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 07.07.2023 18:15, Ziyao via Tinycc-devel wrote:
Hi, I noticed that test 131 (authored by me) has been modified in commit 5b28165: Fix test 131 for 32 bits targets: struct with two long int members are replaced by long long int ones. Test 131 (return struct in registers) is intended to test whether functions return small structs (maybe passed in registers in some ABIs) are handled properly. long long int on 32bit targets seem to be 8 bytes, right? And AFAIK, many ABIs only pass structs with 2 * WORDLENGTH size in registers (for 32-bit architectures, it is 8-bytes and is equal to the size of a struct with two long int members.) Is this fix necessary?
Hi, well, problem is simply that with 32-bit longs your data 0x1234567890abcd would be truncated to 0x7890abcd and the output from %lx would not match the .expect file. Btw is your fix incorrect. The code that you "fixed" is about alignment but there was no alignment problem in your case. The real problem is below at "vtop->c.i += regsize;" which can advance the location to load the 2nd register only for local or global/static memory. For pointers it would need to emit an 'add r, regsize' instruction You can see such code in gv(): gaddrof(); vpushs(PTR_SIZE); gen_op('+'); vtop->r |= VT_LVAL; -- gr
[Prev in Thread] | Current Thread | [Next in Thread] |