This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR target/40838: gcc shouldn't assume that the stack is aligned
- From: Mikulas Patocka <mikulas at artax dot karlin dot mff dot cuni dot cz>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc-patches at gcc dot gnu dot org, ubizjak at gmail dot com
- Date: Sun, 13 Sep 2009 16:10:18 +0200 (CEST)
- Subject: Re: PATCH: PR target/40838: gcc shouldn't assume that the stack is aligned
- References: <Pine.LNX.4.64.0908070254030.30134@artax.karlin.mff.cuni.cz> <20090807071305.GX4462@tyan-ft48-01.lab.bos.redhat.com> <6dc9ffc80908070553q6f9b1b78lc19e6e4a4a5ec73b@mail.gmail.com> <6dc9ffc80908071530x7d4a3965u8021df66a142a0bf@mail.gmail.com> <6dc9ffc80908240900l73d3c97fo2c31fbd0142e75d2@mail.gmail.com> <Pine.LNX.4.64.0909130108530.6268@artax.karlin.mff.cuni.cz> <6dc9ffc80909121855i6c021ab4m863620dad345e208@mail.gmail.com>
On Sat, 12 Sep 2009, H.J. Lu wrote:
> 2009/9/12 Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>:
> >
> > I tried this patch for 4.4.1 (that one posted in bugzilla 40838) with
> > seamonkey 1.1.17 and it relly misses alignment in some parts of it. I used
> > CFLAGS and CXXFLAGS "-O3 -fomit-frame-pointer -frename-registers
> > -march=barcelona"
> >
> > I found the functions that miscompile, the trivial way to find them is to
> > compile seamonkey, do find . -name "*.o"|xargs objdump -d|less, search for
> > "movdqa.*esp" or "movaps.*esp" (or even "esp.*xmm" and "xmm.*esp", but it
> > gives more false positives) and check the function that it has aligment
> > code. There are a few functions that don't. Please look at these
> > functions, the idea of your patch is good, it just needs to be fixed.
> >
> > BTW. gentoo documentation lists -O3 as problematic flag that leads to
> > instability with gcc 4 (they don't way why, but the most likely reason is
> > this alignment issue), it would be good if we could fix it and allow
> > people to use SSE.
> >
>
> Please find a small testcase and upload it to PR 40838.
>
> Thank.s
>
> Thanks.
OK. The misgenerated examples were similar to one of the two issues, so I
posted two examples for them to bugzilla. So you can find the bug in your
patch.
There is another bug: The compiler shouldn't assume that arrays in the
common section are aligned. They may be initialized in a different module
compiled with different compiler that doesn't do alignment.
Mikulas