public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56087] New: [m68k] gcc miscompiles pari (multiplication)
@ 2013-01-23 19:59 tg at mirbsd dot org
  2013-01-23 20:04 ` [Bug target/56087] " tg at mirbsd dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tg at mirbsd dot org @ 2013-01-23 19:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087

             Bug #: 56087
           Summary: [m68k] gcc miscompiles pari (multiplication)
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tg@mirbsd.org


Created attachment 29257
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29257
preprocessed reduced testcase

More context: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698380

This turned out to be a miscompilation of one function; reduced testcase (still
pretty large due to header inclusion, but, oh my) attached. Using the same
register twice in muls.l is not permitted. Removing -funroll-loops lets this
use two distinct ones, as do control flow differences.

This happens on native compilation but can be reproduced on cross compilation.

tg@freewrt:~ $ m68k-linux-gnu-gcc -c -g -O3 -funroll-loops -S -o testcase.S
testcase.i && fgrep muls testcase.S
        muls.l #954437177,%d2:%d2
tg@freewrt:~ $ m68k-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=m68k-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/m68k-linux-gnu/4.6/lto-wrapper
Target: m68k-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-15'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix
--with-gxx-include-dir=/usr/m68k-linux-gnu/include/c++/4.6.3 --libdir=/usr/lib
--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libssp
--enable-plugin --enable-objc-gc --disable-werror --disable-multilib
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=m68k-linux-gnu --program-prefix=m68k-linux-gnu-
--includedir=/usr/m68k-linux-gnu/include
--with-headers=/usr/m68k-linux-gnu/include --with-libs=/usr/m68k-linux-gnu/lib
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-15)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/56087] [m68k] gcc miscompiles pari (multiplication)
  2013-01-23 19:59 [Bug target/56087] New: [m68k] gcc miscompiles pari (multiplication) tg at mirbsd dot org
@ 2013-01-23 20:04 ` tg at mirbsd dot org
  2013-01-23 21:16 ` mikpe at it dot uu.se
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tg at mirbsd dot org @ 2013-01-23 20:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087

Thorsten Glaser <tg at mirbsd dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Target|                            |m68k-linux-gnu
      Known to work|                            |4.7.2
               Host|                            |x86_64-linux-gnu or
                   |                            |m68k-linux-gnu
      Known to fail|                            |4.6.3
              Build|                            |x86_64-linux-gnu or
                   |                            |m68k-linux-gnu

--- Comment #1 from Thorsten Glaser <tg at mirbsd dot org> 2013-01-23 20:03:57 UTC ---
There it works:

root@aranym:~ # gcc-4.7 -c -g -O3 -funroll-loops -S -o testcase.S testcase.i &&
fgrep muls testcase.S
        muls.l #954437177,%d2:%d5
root@aranym:~ # gcc-4.7 -v
Using built-in specs.
COLLECT_GCC=gcc-4.7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/m68k-linux-gnu/4.7/lto-wrapper
Target: m68k-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--disable-libssp --disable-libitm --enable-plugin --enable-objc-gc
--disable-werror --disable-multilib --enable-checking=release
--build=m68k-linux-gnu --host=m68k-linux-gnu --target=m68k-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)

Would still be nice to get a patch for 4.6 which is currently the “workhorse”
compiler for m68k (lots of use, patches, Ada works, fixes and ports to MiNT).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/56087] [m68k] gcc miscompiles pari (multiplication)
  2013-01-23 19:59 [Bug target/56087] New: [m68k] gcc miscompiles pari (multiplication) tg at mirbsd dot org
  2013-01-23 20:04 ` [Bug target/56087] " tg at mirbsd dot org
@ 2013-01-23 21:16 ` mikpe at it dot uu.se
  2013-01-23 22:15 ` tg at mirbsd dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mikpe at it dot uu.se @ 2013-01-23 21:16 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2013-01-23 21:15:40 UTC ---
(In reply to comment #0)

> Using the same register twice in muls.l is not permitted. 

This sounds a lot like PR52573, a patch was proposed in July 2012 and finally
approved and committed a few days ago in r195288, see
<http://gcc.gnu.org/ml/gcc-patches/2013-01/msg00936.html>.

Can you confirm that Debian's gcc 4.6 lacks the PR52573 fix but its 4.7 does
have the fix?  If that's not the case, then this must be a different bug that
just happens to have symptoms similar to PR52573.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/56087] [m68k] gcc miscompiles pari (multiplication)
  2013-01-23 19:59 [Bug target/56087] New: [m68k] gcc miscompiles pari (multiplication) tg at mirbsd dot org
  2013-01-23 20:04 ` [Bug target/56087] " tg at mirbsd dot org
  2013-01-23 21:16 ` mikpe at it dot uu.se
@ 2013-01-23 22:15 ` tg at mirbsd dot org
  2013-01-24  9:31 ` mikpe at it dot uu.se
  2013-01-24  9:38 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tg at mirbsd dot org @ 2013-01-23 22:15 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087

--- Comment #3 from Thorsten Glaser <tg at mirbsd dot org> 2013-01-23 22:15:36 UTC ---
tags 698380 + patch fixed-upstream
thanks

mikpe at it dot uu.se dixit:

>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087

>Mikael Pettersson <mikpe at it dot uu.se> changed:

>--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2013-01-23 21:15:40 UTC ---
>(In reply to comment #0)

>This sounds a lot like PR52573, a patch was proposed in July 2012 and finally
>approved and committed a few days ago in r195288, see
><http://gcc.gnu.org/ml/gcc-patches/2013-01/msg00936.html>.

Thanks Mikael! @GCC developers, in this case sorry for the noise,
but you do have a better overview of possible causes.

Doko, could you please apply the aforementioned patch in your
next upload of gcc-4.6 to unstable?

Thanks in advance,
//mirabilos


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/56087] [m68k] gcc miscompiles pari (multiplication)
  2013-01-23 19:59 [Bug target/56087] New: [m68k] gcc miscompiles pari (multiplication) tg at mirbsd dot org
                   ` (2 preceding siblings ...)
  2013-01-23 22:15 ` tg at mirbsd dot org
@ 2013-01-24  9:31 ` mikpe at it dot uu.se
  2013-01-24  9:38 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikpe at it dot uu.se @ 2013-01-24  9:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087

--- Comment #4 from Mikael Pettersson <mikpe at it dot uu.se> 2013-01-24 09:31:20 UTC ---
I've checked and gcc-4.6 does miscompile this test case, but gets it right with
the PR52573 fix applied.  Vanilla gcc-4.7 doesn't seem to miscompile this
particular test case, but it still miscompiles the original PR52573 test case. 
Anyway, I'm certain this PR is a dup of PR52573 so please close it as such.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/56087] [m68k] gcc miscompiles pari (multiplication)
  2013-01-23 19:59 [Bug target/56087] New: [m68k] gcc miscompiles pari (multiplication) tg at mirbsd dot org
                   ` (3 preceding siblings ...)
  2013-01-24  9:31 ` mikpe at it dot uu.se
@ 2013-01-24  9:38 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-24  9:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-24 09:37:17 UTC ---
Dup.

*** This bug has been marked as a duplicate of bug 52573 ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-24  9:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 19:59 [Bug target/56087] New: [m68k] gcc miscompiles pari (multiplication) tg at mirbsd dot org
2013-01-23 20:04 ` [Bug target/56087] " tg at mirbsd dot org
2013-01-23 21:16 ` mikpe at it dot uu.se
2013-01-23 22:15 ` tg at mirbsd dot org
2013-01-24  9:31 ` mikpe at it dot uu.se
2013-01-24  9:38 ` jakub at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).