Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utah-cs.UUCP Path: utzoo!linus!decvax!decwrl!sun!qubix!ios!oliveb!hplabs!utah-cs!donn From: donn@utah-cs.UUCP (Donn Seeley) Newsgroups: net.lang.c,net.bugs.4bsd Subject: How to make the PCC dump core Message-ID: <3061@utah-cs.UUCP> Date: Sat, 6-Oct-84 04:47:25 EDT Article-I.D.: utah-cs.3061 Posted: Sat Oct 6 04:47:25 1984 Date-Received: Sun, 7-Oct-84 21:36:26 EDT Organization: University of Utah CS Dept Lines: 40 Almost no one rose to the bait when I issued a challenge to find the shortest inputs that cause the Portable C Compiler to dump core. I don't know whether to be happy that the compiler is so robust or disappointed that I won't get more experience fixing PCC bugs... If this is a dull afternoon, you may be interested in examining the 'programs' I had in mind. Here is the shortest string I could find that could be compiled in the normal way to achieve a core dump with the 4.2 BSD PCC on the VAX (note, no trailing newline): *1e38*2 This 7-byte 'program' causes a floating exception when the compiler attempts to evaluate the constant expression '1e38 * 2', which of course is outside the range of the VAX's D- and F- float arithmetic. This bug can be fixed by arranging to catch SIGFPE and complaining when it occurs; I can provide code on request. A much shorter 'program' can be used to get a core dump if you allow me to sneak past the preprocessor and provide input directly to the compiler. This exercise results in a short but suspenseful wait, followed by a segmentation fault: echo -n '#' | /lib/ccom There is a missing end-of-file check in mip/scan.c... Again, code can be supplied on request. Neither of these bugs is so earthshaking that we can't live with them, but they were fun to find and fix. One last trick -- a short program to cause the compiler to go into an infinite loop generating code (gets the error 'expression causes compiler loop'). The amusing results can best be appreciated by running: echo -n 'i=i*i' | /lib/ccom Haven't tried fixing this one yet, Donn Seeley University of Utah CS Dept donn@utah-cs.arpa 40 46' 6"N 111 50' 34"W (801) 581-5668 decvax!utah-cs!donn