dlong@sequoya.ucsd.edu (Dean Long) (11/24/88)
Please verify that the following program does not print 5 6 1.000000123 but in fact prints 5 0 1.000000000 This program "knows" that sun4 (sparc) passes the first 6 words in registers. That is why the last arg takes up the last reg, plus one word of stack. If your machine also passes args in regs, please try this program after adjusting it so that the last parameter straddles the boundary. I have a fix for sparc, but I don't know if it works for all machines passing args in regs. dl ----- struct D { int x, y; }; int fddd(int, double, double, double); /*word: 0 1,2 3,4 5 | 6 */ /*where: regs | stack */ int fdds(int, double, double, struct D); /*word: 0 1,2 3,4 5 | 6 */ /*where: regs | stack */ main() { struct D a; a.x = 5; a.y = 6; fddd(1, 1.0, 1.0, 1.0000001234567); fdds(1, 1.0, 1.0, a); } int fddd(int a, double b, double c, double d) { printf("%.9f\n", d); } int fdds(int a, double b, double c, struct D d) { printf("%d %d\n", d.x, d.y); } From: dlong@sequoya.ucsd.edu (Dean Long) Path: sequoya.ucsd.edu!dlong Newsgroups: gnu.gcc.bugs Subject: Please try this if you have a sun4 Expires: References: Sender: Reply-To: dlong%midgard@ucscc.ucsc.edu (Dean Long) Followup-To: Distribution: gnu Organization: University of California, San Diego Keywords: Please verify that the following program does not print 5 6 1.000000123 but in fact prints 5 0 1.000000000 This program "knows" that sun4 (sparc) passes the first 6 words in registers. That is why the last arg takes up the last reg, plus one word of stack. If your machine also passes args in regs, please try this program after adjusting it so that the last parameter straddles the boundary. I have a fix for sparc, but I don't know if it works for all machines passing args in regs. dl ----- struct D { int x, y; }; int fddd(int, double, double, double); /*word: 0 1,2 3,4 5 | 6 */ /*where: regs | stack */ int fdds(int, double, double, struct D); /*word: 0 1,2 3,4 5 | 6 */ /*where: regs | stack */ main() { struct D a; a.x = 5; a.y = 6; fddd(1, 1.0, 1.0, 1.0000001234567); fdds(1, 1.0, 1.0, a); } int fddd(int a, double b, double c, double d) { printf("%.9f\n", d); } int fdds(int a, double b, double c, struct D d) { printf("%d %d\n", d.x, d.y); } Dean Long dlong%midgard@ucscc.ucsc.edu