public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu
@ 2014-06-16  3:11 su at cs dot ucdavis.edu
  2014-06-16  7:20 ` [Bug tree-optimization/61517] [4.10 Regression] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-06-16  3:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61517
           Summary: wrong code at -Os and above on x86_64-linux-gnu
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk miscompiles the following code on x86_64-linux at -Os and
above in both 32-bit and 64-bit modes.

This is a regression from 4.9.x. 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.10.0 20140615 (experimental) [trunk revision 211685] (GCC) 
$ 
$ gcc-trunk -O1 small.c; a.out
$ gcc-4.9.0 -Os small.c; a.out
$ 
$ gcc-trunk -Os small.c
$ a.out
Aborted (core dumped)
$ 


--------------------------


int a, b, *c = &a;
unsigned short d;

int
main ()
{
  unsigned int e = a;
  *c = 1;
  if (!b)
    {
      d = e;
      *c = d | e;
    }

  if (a != 0) 
    __builtin_abort (); 

  return 0;
}


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

* [Bug tree-optimization/61517] [4.10 Regression] wrong code at -Os and above on x86_64-linux-gnu
  2014-06-16  3:11 [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2014-06-16  7:20 ` jakub at gcc dot gnu.org
  2014-06-16  8:24 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-06-16  7:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-06-16
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |thopre01 at gcc dot gnu.org
   Target Milestone|---                         |4.10.0
            Summary|wrong code at -Os and above |[4.10 Regression] wrong
                   |on x86_64-linux-gnu         |code at -Os and above on
                   |                            |x86_64-linux-gnu
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r210843.


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

* [Bug tree-optimization/61517] [4.10 Regression] wrong code at -Os and above on x86_64-linux-gnu
  2014-06-16  3:11 [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
  2014-06-16  7:20 ` [Bug tree-optimization/61517] [4.10 Regression] " jakub at gcc dot gnu.org
@ 2014-06-16  8:24 ` rguenth at gcc dot gnu.org
  2014-06-16  8:47 ` thopre01 at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-16  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P1


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

* [Bug tree-optimization/61517] [4.10 Regression] wrong code at -Os and above on x86_64-linux-gnu
  2014-06-16  3:11 [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
  2014-06-16  7:20 ` [Bug tree-optimization/61517] [4.10 Regression] " jakub at gcc dot gnu.org
  2014-06-16  8:24 ` rguenth at gcc dot gnu.org
@ 2014-06-16  8:47 ` thopre01 at gcc dot gnu.org
  2014-06-18 10:44 ` thopre01 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2014-06-16  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from thopre01 at gcc dot gnu.org ---
I already got a patch for that which is currently under test. I checked against
this particular testcase and it indeed solves the problem. I'll add the
testcase to the patch and hopefully post something tomorrow or before.


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

* [Bug tree-optimization/61517] [4.10 Regression] wrong code at -Os and above on x86_64-linux-gnu
  2014-06-16  3:11 [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (2 preceding siblings ...)
  2014-06-16  8:47 ` thopre01 at gcc dot gnu.org
@ 2014-06-18 10:44 ` thopre01 at gcc dot gnu.org
  2014-06-30  9:07 ` mikpelinux at gmail dot com
  2014-06-30  9:15 ` thopre01 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2014-06-18 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from thopre01 at gcc dot gnu.org ---
Author: thopre01
Date: Wed Jun 18 10:43:50 2014
New Revision: 211778

URL: https://gcc.gnu.org/viewcvs?rev=211778&root=gcc&view=rev
Log:
2014-06-18  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    PR tree-optimization/61517
    * tree-ssa-math-opts.c (find_bswap_or_nop_1): Adapt to return a stmt
    whose rhs's first tree is the source expression instead of the
    expression itself.
    (find_bswap_or_nop): Likewise.
    (bsap_replace): Rename stmt in cur_stmt. Pass gsi by value and src as a
    gimple stmt whose rhs's first tree is the source. In the memory source
    case, move the stmt to be replaced close to one of the original load to
    avoid the problem of a store between the load and the stmt's original
    location.
    (pass_optimize_bswap::execute): Adapt to change in bswap_replace's
    signature.

    gcc/testsuite/
    * gcc.c-torture/execute/bswap-2.c (incorrect_read_le32): New.
    (incorrect_read_be32): Likewise.
    (main): Call incorrect_read_* to test stmt replacement is made by
    bswap at the right place.
    * gcc.c-torture/execute/pr61517.c: New test.

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


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

* [Bug tree-optimization/61517] [4.10 Regression] wrong code at -Os and above on x86_64-linux-gnu
  2014-06-16  3:11 [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (3 preceding siblings ...)
  2014-06-18 10:44 ` thopre01 at gcc dot gnu.org
@ 2014-06-30  9:07 ` mikpelinux at gmail dot com
  2014-06-30  9:15 ` thopre01 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mikpelinux at gmail dot com @ 2014-06-30  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Isn't this fixed now?


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

* [Bug tree-optimization/61517] [4.10 Regression] wrong code at -Os and above on x86_64-linux-gnu
  2014-06-16  3:11 [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (4 preceding siblings ...)
  2014-06-30  9:07 ` mikpelinux at gmail dot com
@ 2014-06-30  9:15 ` thopre01 at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2014-06-30  9:15 UTC (permalink / raw)
  To: gcc-bugs

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

thopre01 at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |thopre01 at gcc dot gnu.org

--- Comment #5 from thopre01 at gcc dot gnu.org ---
Fixed as of r211778


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

end of thread, other threads:[~2014-06-30  9:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16  3:11 [Bug tree-optimization/61517] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
2014-06-16  7:20 ` [Bug tree-optimization/61517] [4.10 Regression] " jakub at gcc dot gnu.org
2014-06-16  8:24 ` rguenth at gcc dot gnu.org
2014-06-16  8:47 ` thopre01 at gcc dot gnu.org
2014-06-18 10:44 ` thopre01 at gcc dot gnu.org
2014-06-30  9:07 ` mikpelinux at gmail dot com
2014-06-30  9:15 ` thopre01 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).