linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: david.jander@protonic.nl (David Jander)
To: linux-arm-kernel@lists.infradead.org
Subject: GCC 4.6.x miscompiling arm-linux?
Date: Thu, 13 Sep 2012 10:38:03 +0200	[thread overview]
Message-ID: <20120913103803.075ace1f@archvile> (raw)
In-Reply-To: <20559.17990.950313.939717@pilspetsen.it.uu.se>


On Tue, 11 Sep 2012 16:10:14 +0200
Mikael Pettersson <mikpe@it.uu.se> wrote:

> David Jander writes:
>  > On Tue, 11 Sep 2012 14:53:35 +0200
>  > Mikael Pettersson <mikpe@it.uu.se> wrote:
>  > 
>  > > David Jander writes:
>  > >  > On Tue, 11 Sep 2012 13:35:40 +0200
>  > >  > Mikael Pettersson <mikpe@it.uu.se> wrote:
>  > >  > 
>  > >  > > David Jander writes:
>  > >  > >  > > I can make the patches available if there's confirmation that a vanilla
>  > >  > >  > > upstream gcc-4.6.3 doesn't work.
>  > >  > >  > 
>  > >  > >  > I am pretty sure this is the case... do you have a patch series that you can
>  > >  > >  > easily tar and mail to me? I'd like to try those patches with OSELAS, to see
>  > >  > >  > if I can indeed build a gcc-4.6.3 toolchain that generates correct code.... I
>  > >  > >  > already know that I can generate one that doesn't ;-)
>  > >  > >  > 
>  > >  > > ...
>  > >  > >  > > If you're sure no add-on patches were applied, then yes please do.
>  > >  > >  > 
>  > >  > >  > Pretty sure, but not 100%, so I'd like to try your patches first if you don't
>  > >  > >  > mind....
>  > >  > > 
>  > >  > > And I'd like to confirm first. Please tell us the following:
>  > >  > > 
>  > >  > >  > >  > > 2: include the output of gcc -v which tells how that gcc was configured,
>  > >  > 
>  > >  > Using built-in specs.
>  > >  > COLLECT_GCC=/opt/OSELAS.Toolchain-2011.11.1/arm-v5te-linux-gnueabi/gcc-4.6.3-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/bin/arm-v5te-linux-gnueabi-gcc-4.6.3
>  > >  > COLLECT_LTO_WRAPPER=/opt/OSELAS.Toolchain-2011.11.1/arm-v5te-linux-gnueabi/gcc-4.6.3-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/libexec/gcc/arm-v5te-linux-gnueabi/4.6.3/lto-wrapper
>  > >  > Target: arm-v5te-linux-gnueabi
>  > >  > Configured with: /home/djander/ptxdist/OSELAS.Toolchain-2011.11.1/platform-arm-v5te-linux-gnueabi-gcc-4.6.3-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/build-cross/gcc-4.6.3/configure --target=arm-v5te-linux-gnueabi --with-sysroot=/opt/OSELAS.Toolchain-2011.11.1/arm-v5te-linux-gnueabi/gcc-4.6.3
>  > >  > -glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/sysroot-arm-v5te-linux-gnueabi --disable-multilib --with-float=soft --with-fpu=vfp --with-cpu=arm926ej-s --enable-__cxa_atexit --disable-sjlj-exceptions --disable-nls --disable-decimal-float --disable-fixed-point --disable-win32-registry --enable-symvers=gnu --with-pkgversion=OSELAS.Toolchain-2011.11.1 --with-system-zlib --with-gmp=/home/djander/ptxdist/OSELAS.Toolchain-2011.11.1/platform-arm-v5te
>  > >  > -linux-gnueabi-gcc-4.6.3-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/sysroot-host --with-mpfr=/home/djander/ptxdist/OSELAS.Toolchain-2011.11.1/platform-arm-v5te-linux-gnueabi-gcc-4.6.3-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/sysroot-host --prefix=/opt/OSELAS.Toolchain-2011.11.1/arm-v5te-linux-gnueabi/gcc-4.6.3-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized --enable-languages=c,c++ --enable-threads=posix --enable-c99 --enable-long-long --enable-libstdcxx-debug --enable-profile --enable-shared --disable-libssp --enable-checking=release
>  > >  > Thread model: posix
>  > >  > gcc version 4.6.3 (OSELAS.Toolchain-2011.11.1)
>  > >  > 
>  > >  > >  > >  > > 3: give the exact set of gcc options used then compiling the test case.
>  > >  > 
>  > >  > If I type this in a terminal:
>  > >  > 
>  > >  > 
>  > >  > $ /opt/OSELAS.Toolchain-2011.11.1/arm-v5te-linux-gnueabi/gcc-4.6.3-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/bin/arm-v5te-linux-gnueabi-gcc-4.6.3 -Os -S -o - -x c -
>  > >  > 
>  > >  > struct flexcan_regs {
>  > >  >         unsigned int mcr;
>  > >  >         unsigned int rxfgmask;
>  > >  > };
>  > >  > 
>  > >  > #define flexcan_read(a) (*(volatile unsigned int *)(a))
>  > >  > #define flexcan_write(v,a)      (*(volatile unsigned int *)(a) = (v))
>  > >  > 
>  > >  > int flexcan_chip_start(int ver, struct flexcan_regs *regs)
>  > >  > {
>  > >  >         flexcan_write(0, &regs->mcr);
>  > >  > 
>  > >  >         if (ver >= 10)
>  > >  >                 flexcan_write(0, &regs->rxfgmask);
>  > >  > 
>  > >  >         return 0;
>  > >  > }
>  > >  > 
>  > >  > 
>  > >  > I get this output after hitting <CTRL-D>:
>  > >  > 
>  > >  >         .cpu arm926ej-s
>  > >  >         .fpu softvfp
>  > >  >         .eabi_attribute 20, 1
>  > >  >         .eabi_attribute 21, 1
>  > >  >         .eabi_attribute 23, 3
>  > >  >         .eabi_attribute 24, 1
>  > >  >         .eabi_attribute 25, 1
>  > >  >         .eabi_attribute 26, 2
>  > >  >         .eabi_attribute 30, 4
>  > >  >         .eabi_attribute 18, 4
>  > >  >         .file   ""
>  > >  >         .text
>  > >  >         .align  2
>  > >  >         .global flexcan_chip_start
>  > >  >         .type   flexcan_chip_start, %function
>  > >  > flexcan_chip_start:
>  > >  >         @ args = 0, pretend = 0, frame = 0
>  > >  >         @ frame_needed = 0, uses_anonymous_args = 0
>  > >  >         @ link register save eliminated.
>  > >  >         mov     r3, #0
>  > >  >         cmp     r0, #9
>  > >  >         str     r3, [r1, #0]
>  > >  >         ldrle   r3, [r1, #4]
>  > >  >         mov     r0, #0
>  > >  >         str     r3, [r1, #4]
>  > >  >         bx      lr
>  > >  >         .size   flexcan_chip_start, .-flexcan_chip_start
>  > >  >         .ident  "GCC: (OSELAS.Toolchain-2011.11.1) 4.6.3"
>  > >  >         .section        .note.GNU-stack,"",%progbits
>  > >  > 
>  > >  > 
>  > >  > Do you need more information?
>  > > 
>  > > No, I can reproduce the bug with vanilla gcc-4.6.3; vanilla 4.7.1 and 4.5.4 are Ok.
>  > > 
>  > > I'll bisect my 4.6.3 patch series to see which patch fixes it.
>  > 
>  > Great. Thanks a lot for your help so far. Looking forward to see what fixes
>  > this issue. Are you implying that you will also file the bug (and possible
>  > patch) with gcc.gnu.org, or do you prefer me to do that?
> 
> This is a known bug: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52445>.
> It was reported and fixed in gcc trunk on March 1 this year, but missed
> the gcc-4.6.3 release made the same day (and frozen a week or so before),
> and it hasn't been applied to gcc-4.6.4 branch yet either.
> 
> I've been using and testing the fix in my own gcc-4.6 branch since March 4
> without regressions. I'm attaching my backport of the fix below.
> 
> I'll ping gcc upstream about getting this into gcc-4.6.4.

Thanks a lot for this patch.
I can confirm that the bug is gone, and no other problems have appeared so
far. Successfully recompiled kernel and the entire userspace (ptxdist) with
the patched toolchain, and all seems well.

Best regards,

-- 
David Jander
Protonic Holland.

  reply	other threads:[~2012-09-13  8:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10 15:16 GCC 4.6.x miscompiling arm-linux? David Jander
2012-09-10 17:11 ` Matthew Leach
2012-09-11  7:27   ` David Jander
2012-09-11  7:54     ` David Jander
2012-09-11  8:11     ` Mikael Pettersson
2012-09-11  8:49       ` David Jander
2012-09-11  9:41         ` Mikael Pettersson
2012-09-11 10:37           ` David Jander
2012-09-11 11:35             ` Mikael Pettersson
2012-09-11 11:52               ` David Jander
2012-09-11 12:53                 ` Mikael Pettersson
2012-09-11 13:43                   ` David Jander
2012-09-11 14:10                     ` Mikael Pettersson
2012-09-13  8:38                       ` David Jander [this message]
2012-09-11  8:48     ` Sascha Hauer
2012-09-11  9:31       ` David Jander
2012-09-11 10:29         ` Michael Olbrich
2012-09-11 10:33           ` Matthew Leach
2012-09-11 10:42           ` David Jander
2012-09-11 13:07             ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120913103803.075ace1f@archvile \
    --to=david.jander@protonic.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).