delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/03/25/06:53:43

From: afn06760 AT afn DOT org
Subject: Re: B19: gcc optimizer generates bad code
25 Mar 1998 06:53:43 -0800 :
Message-ID: <199803222136.VAA67570.cygnus.gnu-win32@out5.ibm.net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

Congratulations. You've discovered the O2 bug.  Use
-fno-strength-reduce and drink lots of fluids.



>   Tom Uban (uban AT mail DOT netnitco DOT net)
>   Thu, 19 Mar 1998 12:12:20 -0600
>/*
> * 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".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019