Subject: Re: B19: gcc optimizer generates bad code
From: [email-masked] (Erwin Achermann)

29 Mar 1998 03:56:46 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: Tom Uban <[email-masked]>,
        "[email-masked]" <[email-masked]>

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
>  * [email-masked]
>  */
> 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
> "[email-masked]" 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:[email-masked]  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
"[email-masked]" with one line of text: "help".