Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!genrad!mit-eddi!mit-vax!eagle!harpo!seismo!hao!csu-cs!harris From: harris@csu-cs.UUCP Newsgroups: net.lang.c Subject: Re: C compiler bug from ravi, Fairchild Research Message-ID: <2265@csu-cs.UUCP> Date: Fri, 17-Jun-83 16:58:16 EDT Article-I.D.: csu-cs.2265 Posted: Fri Jun 17 16:58:16 1983 Date-Received: Sat, 18-Jun-83 02:07:51 EDT Lines: 32 Note that your local variable declarations for c and d: char *c[], *d[]; don't allocate any space. This defines c and d to be arrays of pointer to char, with dimension 0 since there is no initialization list. The effect is that accesses to c and d are overlayed with whatever local variables are defined afterward. I find it surprising that any compiler produces the output you expected. My question is should such array definitions, with no dimension specified and no following initialization list be allowed at the local level? Should the definition generate a compiler error or is this "overlaying" of local variables considered a "feature"? As a simpler example, try the following: main() { char s[]; int i; i = 0x12345678; s[0] = 'a'; printf("i = 0x%08x\n",i); } On the compilers I have tried this generates: i = 0x61345678 K. Harris ucbvax!hplabs!hpfcld!kah