Issue Details (XML | Word | Printable)

Key: PCC-1
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Mattias Pantzare
Reporter: Mattias Pantzare
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Stack alignment is wrong on Mac OS X on i386

Created: 14/Nov/08 11:12 PM   Updated: 06/Mar/09 09:21 PM
Component/s: i386 target
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Text File osx_i386.patch (2 kB)
2. Text File osx_i386_2.patch (1 kB)

 Description  « Hide
The stack must be 16-byte aligned on Mac OS X i386. The attached patch fixes that.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 16/Nov/08 07:27 PM
In this part of the patch,

+ if (p->n_type == PTR+VOID)
+ isptrvoid = 1;
+ r = tempnode(0, p->n_type, p->n_df, p->n_sue);
+ tmpnr = regno(r);
+ r = buildtree(ASSIGN, r, p);
+ p = tempnode(tmpnr, r->n_type, r->n_df, r->n_sue);
+ if (isptrvoid) {
+ p = block(PCONV, p, NIL, PTR+VOID,
+ p->n_df, MKSUE(PTR+VOID));
+ }
+ p = buildtree(COMOP, r, p);

Is there any specific reason you don't do something like this:

        r = tempnode(0, p->n_type, p->n_df, p->n_sue);
        l = tcopy(r);
        p = buildtree(COMOP, buildtree(ASSIGN, r, p), l);

instead of the type fiddling? I think that should give the same result.

Mattias Pantzare added a comment - 17/Nov/08 09:18 PM
Yes, that works. New patch in osx_i386_2.patch

Mattias Pantzare added a comment - 17/Nov/08 11:20 PM
Patch is committed.

This needs further testing, but that is a bit difficult unless PCC-2 is fixed.

Mattias Pantzare added a comment - 08/Feb/09 11:57 PM
Dynamic arrays breaks alignment.