Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!cca!ima!ism780b!jim From: jim@ism780b.UUCP Newsgroups: net.lang.c Subject: Re: Self-reproducing C programs - (nf) Message-ID: <46@ism780b.UUCP> Date: Mon, 1-Oct-84 00:23:39 EDT Article-I.D.: ism780b.46 Posted: Mon Oct 1 00:23:39 1984 Date-Received: Tue, 2-Oct-84 05:42:30 EDT Lines: 26 #R:alice:-298800:ism780b:25500021:000:923 ism780b!jim Sep 30 08:24:00 1984 >It is possible to generate (syntactically invalid) C programs whose error message >output from cc is identical to the program input. An easy way is to use the >following shell script: > >echo hi >x >echo bye >junk.c >until cmp -s x junk.c >do mv x junk.c > cc junk.c 2>x >done > >When this terminates, it will have found a fixed-point of the cc command. >I won't reproduce the output here. It varies from compiler to compiler, >and can be more than a hundred lines long. You mean *if* this terminates. It seems to me that the "fixed point" is only reached when the file size limit is reached or if there is an arbitrary limit on the number of error messages produced, since for most if not all compilers this procedure is divergent. Also, a compiler which, .e.g., printed the input line with the erroneous portion(s) bracketed would diverge on the first line. -- Jim Balter, INTERACTIVE Systems (ima!jim)