Path: utzoo!utgpu!cunews!bnrgate!uunet!mcsun!ukc!mucs!cns!usenet From: rogersh%p2c@uk.ac.man.cs Newsgroups: eunet.micro.acorn,comp.sys.acorn Subject: Re: Possible bug in C compiler Message-ID: <1991Jan18.155326.24275@cns.umist.ac.uk> Date: 18 Jan 91 15:53:26 GMT References: <1991Jan18.150311.23599@cns.umist.ac.uk> Sender: usenet@cns.umist.ac.uk (News System) Organization: Murder Inc. Lines: 45 In article <1991Jan18.150311.23599@cns.umist.ac.uk> vanaards%t7@uk.ac.man.cs writes: > > I've just compiled this source, only a few warnings, but unexpectidly >I discovered that the executable is about 1Meg long!!! How can that be, >is this really a bug in the C compiler - could someone else verify my >results. > Extracts from the program are below: The C compiler statically links in these arrays which are *huge*. Whoever wrote this should be calling malloc(). Basically the 1 Meg. executable contains vast tracts of zero initialised data which most other compilers would generate code to create at runtime (or maybe the linker should do it). .. > >#define ALPHABET 256 >#define BUFSIZE 50000 >#define DICTSIZE BUFSIZE >#define MOD 50000 >#define OUTBUFSIZE 50000 > >int table[MOD]; > >int parent[DICTSIZE]; >int num[DICTSIZE]; >int next[DICTSIZE]; > .. > >unsigned char buf[BUFSIZE]; > .. >int outn[OUTBUFSIZE]; >int outb[OUTBUFSIZE]; [ H.J.Rogers (INTERNET: rogersh%p4%cs.man.ac.uk@cunyvm.cuny.edu) ] [ ,_, (BITNET/EARN: rogersh%p4%cs.man.ac.uk@UKACRL.BITNET) ] [ :-(_)-o (UUCP: ...!uunet!cunyvm.cuny.edu!cs.man.ac.uk!p4!rogersh) ] [ _} {_ (JANET: rogersh%p4@uk.ac.man.cs) ]