Re: Silent gcc 4.2.0 loop optimization bug with -O2

From: Jung-uk Kim <jkim_at_FreeBSD.org>
Date: Mon, 25 Jun 2007 17:24:56 -0400
On Monday 25 June 2007 04:04 pm, Sascha Holzleiter wrote:
> On Mon, 2007-06-25 at 08:48 -0700, Garrett Cooper wrote:
> >     It's covered in gcc 4.2.1 AFAIK because it's the same /
> > similar to the bug with xorg-server's scanpci.c.
> >
> >     Before pursuing your filed bug too much, please switch over
> > to the gcc 4.2.1 snapshot provided by Kris a week back, compile
> > stuff, and see if the error persists.
>
> Just a quick test as i just happen to have the new patch running on
> this box:
>
> (aperum_at_dreamland) /home/aperum> cc -O2 a.c
> (aperum_at_dreamland) /home/aperum> ./a.out
> (aperum_at_dreamland) /home/aperum> cc -O1 a.c
> (aperum_at_dreamland) /home/aperum> ./a.out
> MUST BE HERE!!! 7
> MUST BE HERE!!! 8
> MUST BE HERE!!! 9
>
> (aperum_at_dreamland) /home/aperum> cc -v
> Using built-in specs.
> Target: amd64-undermydesk-freebsd
> Configured with: FreeBSD/amd64 system compiler
> Thread model: posix
> gcc version 4.2.1 20070614 prerelease [FreeBSD]
>
> So this doesn't seem to be fixed with Kris' snapshot.

It seems -fno-tree-rvp can work around it:

%cc --version
cc (GCC) 4.2.0 20070514 [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There 
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

%cc -O2 -o test test.c
%./test
1: dead
2: beef
3: 1337
4: 4242
%cc -fno-tree-vrp -O2 -o test test.c
%./test
1: dead
2: beef
3: 1337
4: 4242
MUST BE HERE!!! 7
MUST BE HERE!!! 8
MUST BE HERE!!! 9

FYI,

Jung-uk Kim
Received on Mon Jun 25 2007 - 19:25:11 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:13 UTC