🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1982

Please try this if you have a sun4

#1982
From: Dean Long
Date: Thu, 24 Nov 1988 01:26
115 lines
3060 bytes
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
Technical Details
Message-ID: <5554@sdcsvax.UCSD.EDU>
Path: arc1-ca.pugleaf.net!utzoo!yunexus!telly!ddsw1!mcdchg!rutgers!ucsd!sdcsvax!sequoya.ucsd.edu!dlong

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!yunexus!telly!ddsw1!mcdchg!rutgers!ucsd!sdcsvax!sequoya.ucsd.edu!dlong
From: dlong@sequoya.ucsd.edu (Dean Long)
Newsgroups: gnu.gcc.bug
Subject: Please try this if you have a sun4
Message-ID: <5554@sdcsvax.UCSD.EDU>
Date: 24 Nov 88 01:26:35 GMT
Article-I.D.: sdcsvax.5554
Sender: nobody@sdcsvax.UCSD.EDU
Reply-To: dlong%midgard@ucscc.ucsc.edu (Dean Long)
Distribution: gnu
Organization: University of California, San Diego
Lines: 115