paul@UUNET.UU.NET (Paul Hudson) (02/15/89)
The following program should print 0 100 100 100 100 0 but instead prints 100 0 100 0 100 0 (the last argument 3 times (?)) struct p { float x, y; }; struct p make_p(float x, float y) { struct p r; r.x = x; r.y = y; return r; } struct p return_p(struct p p) { return p; } void print_p(struct p p1, struct p p2, struct p p3) { printf("%g %g %g %g %g %g\n", p1.x, p1.y, p2.x, p2.y, p3.x, p3.y); } main() { print_p(return_p(make_p(0.0, 100.0)), return_p(make_p(100.0, 100.0)), return_p(make_p(100.0, 0.0))); } compiled with gcc -O. In general sparc gcc seems very fragile with struct args and returns, which is unfortunate since that's the way I write code.
paul@UUNET.UU.NET (Paul Hudson) (02/15/89)
(Sorry - forgot my address previously) The following program should print 0 100 100 100 100 0 but instead prints 100 0 100 0 100 0 (the last argument 3 times (?)) struct p { float x, y; }; struct p make_p(float x, float y) { struct p r; r.x = x; r.y = y; return r; } struct p return_p(struct p p) { return p; } void print_p(struct p p1, struct p p2, struct p p3) { printf("%g %g %g %g %g %g\n", p1.x, p1.y, p2.x, p2.y, p3.x, p3.y); } main() { print_p(return_p(make_p(0.0, 100.0)), return_p(make_p(100.0, 100.0)), return_p(make_p(100.0, 0.0))); } compiled with gcc -O. In general sparc gcc seems very fragile with struct args and returns, which is unfortunate since that's the way I write code. Paul Hudson Snail mail: Monotype ADG Email: ...!ukc!acorn!moncam!paul Science Park, paul@moncam.co.uk Milton Road, "Sun Microsysytems: Cambridge, The Company is Arrogant (TM)" CB4 4FQ