Xref: utzoo comp.unix.ultrix:5022 comp.lang.c:33047 uw.unix:422 Path: utzoo!dciem!nttor!contact!watcsc!maytag!watdragon!watsol.waterloo.edu!tbray From: tbray@watsol.waterloo.edu (Tim Bray) Newsgroups: comp.unix.ultrix,comp.lang.c,uw.unix Subject: HORRIBLE bug in ultrix 3.1 cc Message-ID: <1990Oct22.035207.20086@watdragon.waterloo.edu> Date: 22 Oct 90 03:52:07 GMT Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes) Organization: University of Waterloo Lines: 48 Briefly phrased, having two declarations for one external function, one prototyped, the other not, seems to send cc into an LSD flashback. Now maybe you guys out there would NEVER end up including 2 declarations of malloc in a source file, but it can happen... By the way, I checked, and this is *not* in mips cc, which has the decency to throw it out (a wonky error message, but hey...). This one has just cost me a whole weekend's work, so I'm in a bitter mood. Take the following. Put it in ccbug.c. First do: cc -DBAD ccbug.c ...nasty... Then do: cc -DWORSE -o ccbug ccbug.c ./ccbug ...really seriously nasty... Cheers, Tim Bray, Open Text Systems, Waterloo, Ont. ----Cut here----------------------------------- #if defined(BAD) || defined(WORSE) extern char * malloc(); extern char * malloc(unsigned int size); #endif #ifdef BAD int foo(int *, int, int, int, int, int *); #endif BAD int foo(a1, a2, a3, a4, a5, a6) int * a1; int a2; int a3; int a4; int a5; int * a6; { printf("args: %d %d %d %d %d %d\n", a1, a2, a3, a4, a5, a6); } main() { foo((int *) 100, 200, 300, 400, 500, (int *) 600); }