Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2012 01:55:07 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Gleb Kurtsou <gleb.kurtsou@gmail.com>
Cc:        mdf@freebsd.org, freebsd-hackers@freebsd.org, Piotr Nowak <pn@semihalf.com>, Rafal Jaworowski <raj@semihalf.com>, Nathan Whitehorn <nwhitehorn@freebsd.org>, Arnaud Lacombe <lacombar@gmail.com>, Ryan Stone <rysto32@gmail.com>
Subject:   Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64
Message-ID:  <4FB832DB.7070203@FreeBSD.org>
In-Reply-To: <20111210012124.GA95149@reks>
References:  <20111119100150.GA1560@reks> <CACqU3MXf%2BsbTpZMbqugmMKKb1BEbp6sNzeTkXfvnQtZ1E4ukEA@mail.gmail.com> <BA73AB23-650A-4241-BBAC-BA01BD372AA3@semihalf.com> <20111208090159.GA1924@cq1> <4EE0EB8C.7050800@freebsd.org> <6D023449-EDEA-4B1C-975D-54AA2F4328CE@semihalf.com> <20111209181550.GA3555@reks> <CAFMmRNwt62NDhan72%2BMVFw1iYswP2ixpKMyKnMCnd_KNK0zVbw@mail.gmail.com> <20111210012124.GA95149@reks>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2011-12-10 02:21, Gleb Kurtsou wrote:
> Please find test case and test results attached. (gcc-test1.shar.txt)
> 
> The long story short: only gcc-4.2 is affected, gcc 3.4, 4.4 and 4.6 are
> ok. clang is ok. (test-cc.txt)
> 
> Nearly all of the workarounds I used in original test doesn't work in
> this test case (see #ifdef BAD_FIX in sources).
> 
> gcc 4.2 fails even with -O1, it has nothing to do with
> -fno-omit-frame-pointer, finline-functions, etc. (test-cflags.txt)
> 
> Compile with -DFIX1 to work around problem (replace struct assignment
> with memcpy):
> % make test XFLAGS="-O2 -DFIX1"
> rm -f gcc-test1 src1.o src2.o src3.o
> cc -O2 -DFIX1 -g -std=gnu99   -c src1.c
> cc -O2 -DFIX1 -g -std=gnu99   -c src2.c
> cc -O2 -DFIX1 -g -std=gnu99   -c src3.c
> cc -O2 -DFIX1 -g -std=gnu99    -o gcc-test1 src1.o src2.o src3.o 
> /home/gleb/projects/gcc-test1/gcc-test1
> ok
> 
> Happy hacking!

Hi Gleb,

I did some bisecting, and I found the exact gcc trunk revision that
fixes this bug:

  http://gcc.gnu.org/viewcvs?view=revision&revision=119760

So far the good news, now the bad news: this revision is actually a
merge from gcc's mem-ssa branch!  The full diff is almost 10,000
lines...

Also, although it's still under GPLv2, the diff doesn't apply cleanly to
our version. :(



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