Path: utzoo!attcan!uunet!jarthur!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!nic.MR.NET!shamash!mercury.udev.cdc.com!dwl From: dwl@mercury.udev.cdc.com (Daren W Latham) Newsgroups: comp.sys.mips Subject: compiler bug Message-ID: <18302@shamash.cdc.com> Date: 5 Mar 90 19:45:47 GMT Sender: news@shamash.cdc.com Reply-To: dwl@mercury.udev.cdc.com (Daren W Latham) Organization: Control Data Corp., Arden Hills, MN Lines: 56 I have just run across what I believe is a bug in the C compiler. It doesn't matter if optimization is turned on or not. This program works correctly with other C compilers. Does anybody (mips perhaps) know if this bug is documented, or just what the status of this is. I am running on: RC2030: MIPS R2000A Processor Chip, Revision 2.0 MIPS R2010A VLSI Floating Point Chip Revision: 2.0 RISC/os Release 4.10 mips Version UMIPS and on a M2000: MIPS R3000 Processor Chip, Revision 2.0 MIPS R3010 VLSI Floating Point Chip Revision: 2.0 RISC/os Release 4_0 mips Version UMIPS -- Daren W. Latham | Control Data Corporation | (612)482-3457 Arden Hills, MN | /* sample program to show compiler bug * * Note that the first printf displays a value of 10 and the second * printf correctly displays a value of 13 for 5+8. * * It doesn't make a difference if optimization is turned on or off. * */ #include #define PushArg(n) argStack[argStackP++] = n #define PopArg() argStack[--argStackP] main() { int argStack[10]; int argStackP = 0; int temp; PushArg(5); PushArg(8); temp = PopArg() + PopArg(); printf ("temp = %d \n", temp); PushArg(5); PushArg(8); temp = PopArg(); temp += PopArg(); printf ("temp = %d \n", temp); }