Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!spool.mu.edu!uunet!mcsun!hp4nl!charon!robertl From: robertl@cwi.nl (Robert van Liere) Newsgroups: comp.sys.mips Subject: Bug in 'cc' (version 2.0) ? Message-ID: <2925@charon.cwi.nl> Date: 12 Feb 91 09:48:02 GMT Sender: news@cwi.nl Distribution: inet Organization: CWI, Amsterdam Lines: 53 Originator: robertl@paling.cwi.nl I'm not sure if this is the right newsgroup but the following program displays a (maybe well-known) bug in the MIPS C compiler (version 2.0). I'm running on a SGI 4D/25. ---------- x.c --------------- main () { char c = 'a'; #ifdef PLUSBECOMES c += (double) 1.0; #else c = c + (double) 1.0; #endif printf ("c = %c\n", c); } ---------- x.c --------------- Compile as follows : $ cc -float -DPLUSBECOMES xx.c as1: Warning: xx.c, line 5: nop must be inside .set noreorder section $ a.out $ c = a $ cc -float xx.c $ a.out $ c = b Additional comments : * Compiling without the '-float' flag gives the same (and correct) result in both cases. * Compiling without an explicit cast in the assignment statements gives the same (and correct) result in both cases. -- Robert van Liere --------------------------------- Robert van Liere, Department of Interactive Systems, Center for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands robertl@cwi.nl -- Robert van Liere, Department of Interactive Systems, Center for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands robertl@cwi.nl