Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jun 2007 19:25:59 +0400
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        Ed Schouten <ed@fxq.nl>
Cc:        kan@freebsd.org, current@freebsd.org
Subject:   Re: Silent gcc 4.2.0 loop optimization bug with -O2
Message-ID:  <20070625152559.GA54055@nagual.pp.ru>
In-Reply-To: <20070625151508.GO27942@hoeg.nl>
References:  <20070625130913.GA50273@nagual.pp.ru> <20070625133951.GA51324@nagual.pp.ru> <8e5ef5f70706250659v48f64410wb5399985a571087e@mail.gmail.com> <20070625145627.GA53685@nagual.pp.ru> <20070625151508.GO27942@hoeg.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Mon, Jun 25, 2007 at 05:15:08PM +0200, Ed Schouten wrote:
> I did some more stripping and it turns out this is the problem
> 
> | int
> | main(int argc, char *argv[])
> | {
> |         int i;
> |         int numbers[4] = { 0xdead, 0xbeef, 0x1337, 0x4242 };
> | 
> |         for (i = 1; i <= 12; i++) {
> |                 if (i <= 4)
> |                         printf("%d: %x\n", i, numbers[i-1]);
> |                 else if (i >= 7 && i <= 9)
> |                         printf("MUST BE HERE!!! %d\n", i);
> |         }
> | }
> 
> When you increase the size of the array to 6 or higher, it does what you
> want. It clearly looks like a compiler bug; the size of the array
> shouldn't have an effect on the amount of iterations. 
> 
> You should really file a bug at GCC's to make sure this gets fixed in
> 4.2.1.

I am not familiar with gcc bugs reporting system at all. Could somebody 
running 4.2.1 snapshot tells, is it already fixed, by chance? If no, could 
sumebody fill bug report to them or provide detailed instructions how to 
do that, please?

In any case, we must change default CFLAGS from
-O2 -fno-strict-aliasing -pipe
to
-O -pipe
for -current immediately.

-- 
http://ache.pp.ru/

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFGf96HVg5YK5ZEdN0RAnb+AJ9p5T6EVk6R0CNLtRiFquuh+dz//gCgmx/q
x/f1Kc3u4/Z1Xr7cz3BMyo0=
=RncG
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070625152559.GA54055>