Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!nih-csl!elsie!ado From: nih-csl!elsie!ado@UUNET.UU.NET (Arthur David Olson) Newsgroups: gnu.gcc.bug Subject: Gnu gcc 1.36 fails to catch repeated #define arguments (with fixed fix) Message-ID: <9001190239.AA26078@elsie> Date: 19 Jan 90 02:39:18 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 49 Index: cccp.c (We're running SunOS 4.0.3 on a Sun 3/280.) Description: gcc 1.36 fails to catch repeated #define arguments Repeat-By: Script started on Wed Jan 17 09:19:10 1990 elsie$ echo '#define macro(a, a)' > try.c elsie$ /usr/local/bin/gcc -E -v try.c gcc version 1.36 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 try.c GNU CPP version 1.36 # 1 "try.c" elsie$ exit script done on Wed Jan 17 09:19:28 1990 Fix: *** 1.3/cccp.c Wed Jan 17 12:39:19 1990 --- 1.5/cccp.c Wed Jan 17 12:39:22 1990 *************** *** 2841,2846 **** --- 2841,2861 ---- error ("unterminated parameter list in #define"); goto nope; } + { + struct arglist *otemp; + + for (otemp = temp->next; otemp != NULL; otemp = otemp->next) + if (temp->length == otemp->length && + strncmp(temp->name, otemp->name, temp->length) == 0) { + U_CHAR *name; + + name = (U_CHAR *) alloca(temp->length + 1); + (void) strncpy(name, temp->name, temp->length); + name[temp->length] = '\0'; + error ("repeated #define argument name (%s)", name); + goto nope; + } + } } ++bp; /* skip paren */ -- Arthur David Olson ado@alw.nih.gov ADO is a trademark of Ampex.