🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.dec
Article #1784

Re: Compiler Bug

#1784
From: Steve V. Hodsdon
Date: Fri, 27 Jul 1990 15:29
59 lines
2021 bytes
In article <3152@rwthinf.UUCP>, davids@bduxpe (Peter Davids) writes:
> 
> We have DEC 3100 Workstation with Ultrix 3.1 and UWS 2.1 running.
> The following little (and correct!?) C-program gives different results,
> depending on the optimizer options.
> The programm look a bit like the own posted some time ago...
> 
> 
> ====cut here==============================
> char *   malloc();
> 
> main()
> {
>   char *   ba;
>   int i=3;
>   printf("%d\n", i*(-6) );
>   ba = malloc (100);
>   printf("%d\n", i*(-6) );
> }
> 
> I will be happy about any idea or answer (other bugs would be also
> very interesting)

I am running a MIPS box with the R2600 CPU card (R2000 processor).

Here is the output: (using uMIPS 2.0)

[shodsdon@(bifur)/u/shodsdon/src]
3 %cc b.c
[shodsdon@(bifur)/u/shodsdon/src]
4 %a.out
-18
18
[shodsdon@(bifur)/u/shodsdon/src]
5 %cc -O b.c
[shodsdon@(bifur)/u/shodsdon/src]
6 %a.out
-18
-18
[shodsdon@(bifur)/u/shodsdon/src]
7 %cc -O0 b.c
[shodsdon@(bifur)/u/shodsdon/src]
8 %a.out
18
18


Kinda makes you wonder.

> _________________________________________________________________________
> Peter Davids   Lehrstuhl fuer Informatik IV   RWTH Aachen   D-5100 Aachen
> Tel. +241-804522    Fax: +241-806295     davids@informatik.rwth-aachen.de


-- 
Steve Hodsdon                          | Stay sane inside insanity.
shodsdon@elrond.CalComp.COM            | Don't dream it -  Be it.
{decvax|harvard}!elrond!shodsdon       |
(603) 885-8324                         |
Technical Details
Message-ID: <2856@elrond.CalComp.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!decwrl!bacchus.pa.dec.com!decvax.dec.com!elrond!shodsdon
References: <3152@rwthinf.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!decwrl!bacchus.pa.dec.com!decvax.dec.com!elrond!shodsdon
From: shodsdon@elrond.CalComp.COM (Steve V. Hodsdon)
Newsgroups: comp.sys.dec
Subject: Re: Compiler Bug
Summary: Fails on a MIPS box also...
Message-ID: <2856@elrond.CalComp.COM>
Date: 27 Jul 90 15:29:11 GMT
References: <3152@rwthinf.UUCP>
Distribution: comp
Organization: Calcomp, A Lockheed Company, Hudson, NH, USA
Lines: 59