🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1518

assignment from literal to double fails in 2.1

#1518
From: mitch Mitchell N. Perilstein
Date: Sat, 02 Jan 1993 10:17
34 lines
1432 bytes
Assignment with type conversion from a literal to a double is broken.
gcc 2.1 on Sparc SunOS 4.1.2 and on RISC Ultrix 4.2 produces an
unexpected result: 

    convert int to double: -2147483648 -> -2147483648.000000
    convert lit to double: -2147483648 -> 2147483648.000000

I expected
    
    convert int to double: -2147483648 -> -2147483648.000000
    convert lit to double: -2147483648 -> -2147483648.000000

The vendor /bin/cc gave the second result on both platforms. Here is the
code. 

#define INT_MIN (-2147483648)	/* - (2^31) */

int main()
{
    double from_int, from_literal;
    int i;

    i = INT_MIN;
    from_int = i;
    printf("convert int to double: %d -> %f\n", i, from_int);

    from_literal = INT_MIN;
    printf("convert lit to double: %d -> %f\n", INT_MIN, from_literal);
}

Respectfully,
---
 Mitchell N. Perilstein   CAD Language Systems, Inc.   410-992-5700 x225 
 Member, League for Programming Freedom.  Mail lpf@uunet.uu.net for info.
Technical Details
Message-ID: <MITCH.93Jan2051743@clsi.clsi>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!.UUCP!mitch

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!.UUCP!mitch
From: mitch@.UUCP (Mitchell N. Perilstein)
Subject: assignment from literal to double fails in 2.1
Message-ID: <MITCH.93Jan2051743@clsi.clsi>
Sender: gnulists@ai.mit.edu
Organization: CAD Language Systems, Inc.
Distribution: gnu
Date: Sat, 2 Jan 1993 10:17:43 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 35