🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.dec
Article #1785

Re: Compiler Bug

#1785
From: Jim Hudgens
Date: Mon, 30 Jul 1990 14:20
50 lines
1347 bytes
How about this one. 
Under Ultrix 4.0, we get this behavior:

$ cat bug.c
#include<stdio.h>

main()
{
    int d;
    double f;
    long l;
    int i;
    i = 4;
    f = 244.0;
    l = 2000;
    d = l * i/f;
    printf("%d * %d / %f = %d\n",
            l, i, f, d);
}

$ cc bug.c
$ a.out
2000 * 4 / 244.000000 = 32
$ cc -O3 bug.c
$ a.out
Segmentation fault

It seems to be crashing in the printf.  Nothing obvious in the 
assembly listing.  Yet under Ultrix 3.1d, we get:

$ cc bug.c
$ a.out
2000 * 4 / 244.000000 = 32
$ cc -O3 bug.c
$ a.out
2000 * 4 / 244.000000 = 32
$

This code is condensed from a fairly large program and was found by 
a scientist here.  

---
Disclaimer:  I didn't do it.
Jim Hudgens		Supercomputer Computations Research Institute
hudgens@sun13.scri.fsu.edu	
-- 
---
Disclaimer:  I didn't do it.
Jim Hudgens		Supercomputer Computations Research Institute
hudgens@sun13.scri.fsu.edu	
Technical Details
Message-ID: <327@sun13.scri.fsu.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!rutgers!mephisto!prism!sun13!hudgens
References: <3152@rwthinf.UUCP> <5889@crltrx.crl.dec.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!rutgers!mephisto!prism!sun13!hudgens
From: hudgens@sun13.scri.fsu.edu (Jim Hudgens)
Newsgroups: comp.sys.dec
Subject: Re: Compiler Bug
Message-ID: <327@sun13.scri.fsu.edu>
Date: 30 Jul 90 14:20:37 GMT
References: <3152@rwthinf.UUCP> <5889@crltrx.crl.dec.com>
Distribution: na
Organization: SCRI, Florida State University
Lines: 50