From: acherman AT inf DOT ethz DOT ch (Erwin Achermann) Subject: Re: B19: gcc optimizer generates bad code 29 Mar 1998 03:56:46 -0800 Message-ID: <351616B4.CDF8DF06.cygnus.gnu-win32@inf.ethz.ch> References: <3 DOT 0 DOT 5 DOT 32 DOT 19980319121220 DOT 007ae970 AT mail DOT netnitco DOT net> Reply-To: erwin DOT achermann AT switzerland DOT org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Tom Uban , "gnu-win32 AT cygnus DOT com" No such problems are seem using Mumit Khans egcs-1.0.2. I recommende upgrading to his version. http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ Cheers Erwin Tom Uban wrote: > > /* > * When this simple code sample is compiled with the Cygnus B19.1 gcc > * compiler using either -O2 or -O3, bad code is generated. > * gcc -O2 test.c > * or > * gcc -O3 test.c > * > * This program should always print the number 4. When compiled > * with -O2 or -O3 the number 1 is printed. The dissassembled output > * seems to indicate that the loop code generation is broken. > * > * The result of gcc -v is: > * Reading specs from > C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\specs > * gcc driver version 2.7-B19 executing gcc version 2.7-97r2aBeta > * > * The Cygnus B18 (gcc version cygnus-2.7.2-970404) release did not > * exhibit this behavior. > * > * Tom Uban - 17 March 1998 > * uban AT netnitco DOT net > */ > unsigned short foobar = 1; > > main() > { > unsigned short *sptr = &foobar; > unsigned long cksum; > int i; > > cksum = 0; > > for (i = 0; i < 4; i++) > cksum += *sptr; > > printf("%d\n", cksum); > } > > - > For help on using this list (especially unsubscribing), send a message to > "gnu-win32-request AT cygnus DOT com" with one line of text: "help". -- Erwin Achermann Tel: ++41 1 632 74 40 Institut fuer Wissenschaftliches Rechnen Fax: ++41 1 632 11 72 ETH Zentrum, IFW C29.2 mailto:achermann AT inf DOT ethz DOT ch ICQ:4625051 CH-8092 Zuerich http://www.inf.ethz.ch/personal/acherman/ > Perfection is reached, not when there is no longer anything to add, < > but when there is no longer anything to take away. < > -- Antoine de Saint-Exupery < - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".