🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1503

conversion from literal to double in 2.1

#1503
From: mitch Mitchell N. Perilstein
Date: Wed, 30 Dec 1992 21:37
34 lines
1421 bytes
Conversion from int to double is working, but 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.92Dec30163721@pollux.clsi>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!.UUCP!mitch

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!.UUCP!mitch
From: mitch@.UUCP (Mitchell N. Perilstein)
Subject: conversion from literal to double in 2.1
Message-ID: <MITCH.92Dec30163721@pollux.clsi>
Sender: gnulists@ai.mit.edu
Organization: CAD Language Systems, Inc.
Distribution: gnu
Date: Wed, 30 Dec 1992 21:37:21 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 35