Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!unido!rwthinf!davids From: davids@bduxpe (Peter Davids) Newsgroups: comp.sys.dec Subject: Compiler Bug Message-ID: <3152@rwthinf.UUCP> Date: 26 Jul 90 05:41:13 GMT Sender: news@rwthinf.UUCP Distribution: comp Lines: 64 Some days (or weeks) ago, there was a posting in comp.sys.dec or comp.unix.ultrix that described a compiler bug in Ultrix CC. We have DEC 3100 Workstation with Ultrix 3.1 and UWS 2.1 running. The following little (and correct!?) C-program gives different results, depending on the optimizer options. The programm look a bit like the own posted some time ago... ====cut here============================== char * malloc(); main() { char * ba; int i=3; printf("%d\n", i*(-6) ); ba = malloc (100); printf("%d\n", i*(-6) ); } /* * Results: * * Compile with: 'cc b.c' default * * -18 * 18 * * * * Compile with: 'cc -O b.c' optimize * * -18 * -18 * * * * Compile with: 'cc -O0 b.c' don't optimize * * 18 * 18 * * */ ===================================================================== Questions o Does anybody know the reasons for this behaviour o Are results the same unter Ultrix 3.0 or 4.0 (we only have 3.1) o Is there any solution around that problem. I will be happy about any idea or answer (other bugs would be also very interesting) -- _________________________________________________________________________ Peter Davids Lehrstuhl fuer Informatik IV RWTH Aachen D-5100 Aachen Tel. +241-804522 Fax: +241-806295 davids@informatik.rwth-aachen.de