public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap
@ 2014-03-07  6:11 thomas.preudhomme at arm dot com
  2014-03-07  8:32 ` [Bug tree-optimization/60454] " thomas.preudhomme at arm dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-03-07  6:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60454
           Summary: Code mistakenly detected as doing bswap
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.preudhomme at arm dot com

Created attachment 32296
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32296&action=edit
Testcase for bswap incorrect detection

Optimization pass optimize_bswap in tree-ssa-math-opts.c incorrectly detect a
bswap being performed in certain cases, leading to wrong code being generated.

Please find attached a testcase that exhibit the problem. Compile with trunk
gcc with gcc -O2 -fdump-tree-bswap -c testcase.c and observe that
testcase.c.*bswap contains the string "32 bit bswap implementation found at"
while the code does not perform a byte swap. This test was tried on an Ubuntu
"13.10 (saucy) with 4.8.1 and trunk gcc.

gcc 4.8.1 was configured with:

../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.1-10ubuntu9'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu

while trunk gcc was configured with:

../src/configure --prefix=../install --target=arm-none-eabi
--enable-languages=c,c++ --with-mode=thumb --with-cpu=cortex-m3 --with-newlib
--with-headers=../src/newlib/libc/include --enable-newlib-register-fini
--disable-newlib-supplied-syscalls --disable-multilib --with-libexpat
--with-system-zlib --disable-gdbtk --enable-plugins --disable-libgomp
--disable-libmudflap --disable-libquadmath --disable-libssp
--disable-libstdcxx-pch --disable-nls --disable-rda --disable-sid --disable-tui
--disable-utils --disable-werror --disable-fixed-point

I'm currently cleaning a patch to solve this issue.

Best regards.


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

* [Bug tree-optimization/60454] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
@ 2014-03-07  8:32 ` thomas.preudhomme at arm dot com
  2014-03-07  8:51 ` [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-03-07  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Thomas Preud'homme <thomas.preudhomme at arm dot com> ---
Created attachment 32297
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32297&action=edit
Unpreprocessed testcase for incorrect bswap detection


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

* [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
  2014-03-07  8:32 ` [Bug tree-optimization/60454] " thomas.preudhomme at arm dot com
@ 2014-03-07  8:51 ` rguenth at gcc dot gnu.org
  2014-03-07  9:01 ` thomas.preudhomme at arm dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-07  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-07
                 CC|                            |wschmidt at gcc dot gnu.org
   Target Milestone|---                         |4.7.4
            Summary|Code mistakenly detected as |[4.7/4.8/4.9 Regression]
                   |doing bswap                 |Code mistakenly detected as
                   |                            |doing bswap
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Regression from bswap pass introduction.

Bill, can you have a look?


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

* [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
  2014-03-07  8:32 ` [Bug tree-optimization/60454] " thomas.preudhomme at arm dot com
  2014-03-07  8:51 ` [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
@ 2014-03-07  9:01 ` thomas.preudhomme at arm dot com
  2014-03-07  9:22 ` thomas.preudhomme at arm dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-03-07  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Thomas Preud'homme <thomas.preudhomme at arm dot com> ---
Created attachment 32299
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32299&action=edit
Fix_bswap_detection

See in attachment for the patch I wrote to fix the issue. I'm welcoming any
comment on it.


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

* [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (2 preceding siblings ...)
  2014-03-07  9:01 ` thomas.preudhomme at arm dot com
@ 2014-03-07  9:22 ` thomas.preudhomme at arm dot com
  2014-03-07 11:29 ` thomas.preudhomme at arm dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-03-07  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Preud'homme <thomas.preudhomme at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #32299|0                           |1
        is obsolete|                            |

--- Comment #4 from Thomas Preud'homme <thomas.preudhomme at arm dot com> ---
Created attachment 32300
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32300&action=edit
Fix_bswap_detection_with_ChangeLog

Added ChangeLog entries to previous patch.


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

* [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (3 preceding siblings ...)
  2014-03-07  9:22 ` thomas.preudhomme at arm dot com
@ 2014-03-07 11:29 ` thomas.preudhomme at arm dot com
  2014-03-12 10:16 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-03-07 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Thomas Preud'homme <thomas.preudhomme at arm dot com> ---
I have posted the patch on gcc-patches mailing list. The discussion can be
followed from http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00313.html.


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

* [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (4 preceding siblings ...)
  2014-03-07 11:29 ` thomas.preudhomme at arm dot com
@ 2014-03-12 10:16 ` jakub at gcc dot gnu.org
  2014-03-12 12:12 ` [Bug tree-optimization/60454] [4.7/4.8 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-12 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Mar 12 10:15:29 2014
New Revision: 208509

URL: http://gcc.gnu.org/viewcvs?rev=208509&root=gcc&view=rev
Log:
    PR tree-optimization/60454
    * tree-ssa-math-opts.c (find_bswap_1): Fix bswap detection.

    * gcc.c-torture/execute/pr60454.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr60454.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-math-opts.c


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

* [Bug tree-optimization/60454] [4.7/4.8 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (5 preceding siblings ...)
  2014-03-12 10:16 ` jakub at gcc dot gnu.org
@ 2014-03-12 12:12 ` jakub at gcc dot gnu.org
  2014-03-13  5:27 ` thomas.preudhomme at arm dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-12 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
      Known to work|                            |4.9.0
            Summary|[4.7/4.8/4.9 Regression]    |[4.7/4.8 Regression] Code
                   |Code mistakenly detected as |mistakenly detected as
                   |doing bswap                 |doing bswap

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I've applied the patch so that this should now be fixed on the trunk.


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

* [Bug tree-optimization/60454] [4.7/4.8 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (6 preceding siblings ...)
  2014-03-12 12:12 ` [Bug tree-optimization/60454] [4.7/4.8 " jakub at gcc dot gnu.org
@ 2014-03-13  5:27 ` thomas.preudhomme at arm dot com
  2014-03-13  7:00 ` jye2 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-03-13  5:27 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Preud'homme <thomas.preudhomme at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Thomas Preud'homme <thomas.preudhomme at arm dot com> ---
As mentionned by Jakub Jelinek, fixed in trunk


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

* [Bug tree-optimization/60454] [4.7/4.8 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (7 preceding siblings ...)
  2014-03-13  5:27 ` thomas.preudhomme at arm dot com
@ 2014-03-13  7:00 ` jye2 at gcc dot gnu.org
  2014-03-13  7:21 ` jakub at gcc dot gnu.org
  2014-06-12 13:37 ` [Bug tree-optimization/60454] [4.7 " rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jye2 at gcc dot gnu.org @ 2014-03-13  7:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from jye2 at gcc dot gnu.org ---
Author: jye2
Date: Thu Mar 13 07:00:05 2014
New Revision: 208529

URL: http://gcc.gnu.org/viewcvs?rev=208529&root=gcc&view=rev
Log:
2014-03-13  Joey Ye  <joey.ye@arm.com>

        Backport from mainline
        2014-03-12  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        PR tree-optimization/60454
        * tree-ssa-math-opts.c (find_bswap_1): Fix bswap detection.

testsuite:
        * gcc.c-torture/execute/pr60454.c: New test.



Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/execute/pr60454.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-ssa-math-opts.c


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

* [Bug tree-optimization/60454] [4.7/4.8 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (8 preceding siblings ...)
  2014-03-13  7:00 ` jye2 at gcc dot gnu.org
@ 2014-03-13  7:21 ` jakub at gcc dot gnu.org
  2014-06-12 13:37 ` [Bug tree-optimization/60454] [4.7 " rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-13  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
But not fixed on 4.8/4.7 yet.


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

* [Bug tree-optimization/60454] [4.7 Regression] Code mistakenly detected as doing bswap
  2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
                   ` (9 preceding siblings ...)
  2014-03-13  7:21 ` jakub at gcc dot gnu.org
@ 2014-06-12 13:37 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60454

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.7.4                       |4.8.3
      Known to fail|                            |4.7.4

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for 4.8.3.


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

end of thread, other threads:[~2014-06-12 13:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-07  6:11 [Bug tree-optimization/60454] New: Code mistakenly detected as doing bswap thomas.preudhomme at arm dot com
2014-03-07  8:32 ` [Bug tree-optimization/60454] " thomas.preudhomme at arm dot com
2014-03-07  8:51 ` [Bug tree-optimization/60454] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2014-03-07  9:01 ` thomas.preudhomme at arm dot com
2014-03-07  9:22 ` thomas.preudhomme at arm dot com
2014-03-07 11:29 ` thomas.preudhomme at arm dot com
2014-03-12 10:16 ` jakub at gcc dot gnu.org
2014-03-12 12:12 ` [Bug tree-optimization/60454] [4.7/4.8 " jakub at gcc dot gnu.org
2014-03-13  5:27 ` thomas.preudhomme at arm dot com
2014-03-13  7:00 ` jye2 at gcc dot gnu.org
2014-03-13  7:21 ` jakub at gcc dot gnu.org
2014-06-12 13:37 ` [Bug tree-optimization/60454] [4.7 " rguenth 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).