Danny Milosavljevic wrote:
int main() {
        double f = 1.0;
        return 0;
}
...
I get a bus error here:

│   0x24698 <init_putv+1688>  vstr  d0, [r0]                                    
                                                                      │
...
And indeed, (0x24b01e % 8) == 6, not 0.
...
                *(double *)ptr = vtop->c.d

(the latter of which emits VFP instructions that expect double-aligned
pointers).

It seems that in fact, on certain systems, initializing intentionally
misaligned (packed) structure members could crash tcc already during
compilation.

But no such thing happens in this case.  The 'ptr' in init_putv()
comes from

        ptr = sec->data + c;

and it seems that if tcc is doing the right thing then 'c' cannot
be misaligned, and if malloc/realloc on that system is doing the
right thing,  then sec->data cannot be misaligned either.  So...?

--- grischka


Reply via email to