geoff@warwick.UUCP (Geoff Rimmer) (01/26/89)
main() { int z; char *str; z=atoi(gets(str=(char*)malloc(10))); switch(z) { case 1: printf("ONE\n"); break; case 2: printf("TWO\n"); break; case 1: printf("ONE AGAIN\n"); break; } } cc (Sun OS4.0) gives "case.c", line 18: duplicate case in switch, 1 lint (Sun OS4.0) gives case.c(18): duplicate case in switch, 1 but ... gcc version 1.32 DOESN'T COMPLAIN!!! Is there a later version of gcc that has this bug fixed? Geoff ------------------------------------------------------------ Geoff Rimmer, Computer Science, Warwick University, England. geoff@uk.ac.warwick.cs estnkcj@uk.ac.warwick.cu "I didn't ask to be made. No consulted me or considered my feelings in the matter, not that anyone considered that I might *have* feelings. After I was made, I was left in a dark room for six months, and me with this terrible pain in all the diodes down my left side. My one and only true friend was a small rat. One day it climbed into a cavity of my inner leg and died. I've a horrible feeling it's still there." - Marvin, The Hitch Hiker's Guide to the Galaxy. ------------------------------------------------------------
schmidt@siam.ics.uci.edu (Doug Schmidt) (01/27/89)
In article <958@ubu.warwick.UUCP> geoff@emerald.UUCP (Geoff Rimmer) writes: ++ [example of 1.32 failing to detect duplicate cases in a switch ++Is there a later version of gcc that has this bug fixed? ++ ++Geoff Yes! This is fixed in 1.33. See below: ---------------------------------------- gcc version 1.33 /usr/public/lib/gcc/gcc-cpp -v -I/cd/ua/schmidt/include/ -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ bug.c /tmp/cca04847.cpp GNU CPP version 1.33 /usr/public/lib/gcc/gcc-cc1 /tmp/cca04847.cpp -quiet -dumpbase bug.c -fstrength-reduce -finline-functions -version -o /tmp/cca04847.s GNU C version 1.33 (sparc) compiled by GNU C version 1.33. bug.c: In function main: bug.c:16: duplicate case value ---------------------------------------- Doug -- schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente. office: (714) 856-4043 | Per me si va nell'eterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza o voi ch'entrate.