public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu
@ 2015-02-26  1:19 su at cs dot ucdavis.edu
  2015-02-26  3:15 ` [Bug tree-optimization/65216] " ktietz at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: su at cs dot ucdavis.edu @ 2015-02-26  1:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65216
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: 5.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 -O3 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/5.0.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 5.0.0 20150225 (experimental) [trunk revision 220958] (GCC) 
$ 
$ gcc-trunk -O2 small.c; a.out
$ gcc-4.9 -O3 small.c; a.out
$ 
$ gcc-trunk -O3 small.c
$ ./a.out
Aborted (core dumped)
$ 


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


int a, b = 62, e;
volatile int c;
volatile int d;

int
main ()
{
  int f = a = 0;
  for (; a < 2; a++)
    {
      b &= (8 ^ f) & 1;
      for (e = 0; e < 6; e++)
    if (c)
      f = d;
    }

  if (b != 0) 
    __builtin_abort (); 

  return 0;
}


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

* [Bug tree-optimization/65216] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2015-02-26  3:15 ` ktietz at gcc dot gnu.org
  2015-02-26  3:45 ` glisse at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-02-26  3:15 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-25
                 CC|                            |ktietz at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Confirmed.  The & 1 gets lost by pass vrp2


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

* [Bug tree-optimization/65216] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2015-02-26  3:15 ` [Bug tree-optimization/65216] " ktietz at gcc dot gnu.org
@ 2015-02-26  3:45 ` glisse at gcc dot gnu.org
  2015-02-26  5:26 ` [Bug tree-optimization/65216] [5 Regression] " ktietz at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-02-26  3:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
The ranges are wrong before VRP2. Reassoc2 does something suspicious...


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

* [Bug tree-optimization/65216] [5 Regression] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2015-02-26  3:15 ` [Bug tree-optimization/65216] " ktietz at gcc dot gnu.org
  2015-02-26  3:45 ` glisse at gcc dot gnu.org
@ 2015-02-26  5:26 ` ktietz at gcc dot gnu.org
  2015-02-26  8:39 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-02-26  5:26 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


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

* [Bug tree-optimization/65216] [5 Regression] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (2 preceding siblings ...)
  2015-02-26  5:26 ` [Bug tree-optimization/65216] [5 Regression] " ktietz at gcc dot gnu.org
@ 2015-02-26  8:39 ` jakub at gcc dot gnu.org
  2015-02-26 10:14 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-26  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
                 CC|                            |jakub at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r220164, will have a look.


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

* [Bug tree-optimization/65216] [5 Regression] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (3 preceding siblings ...)
  2015-02-26  8:39 ` jakub at gcc dot gnu.org
@ 2015-02-26 10:14 ` rguenth at gcc dot gnu.org
  2015-02-26 12:49 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-26 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> Started with r220164, will have a look.

Yeah, I also pushed this to make issues like this pop up so we can fix them
(VRP is really the pass that should expose bogus range info best).


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

* [Bug tree-optimization/65216] [5 Regression] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (4 preceding siblings ...)
  2015-02-26 10:14 ` rguenth at gcc dot gnu.org
@ 2015-02-26 12:49 ` jakub at gcc dot gnu.org
  2015-02-27  0:12 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-26 12:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 34883
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34883&action=edit
gcc5-pr65216.patch

Untested fix.


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

* [Bug tree-optimization/65216] [5 Regression] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (5 preceding siblings ...)
  2015-02-26 12:49 ` jakub at gcc dot gnu.org
@ 2015-02-27  0:12 ` jakub at gcc dot gnu.org
  2015-02-27  0:25 ` jakub at gcc dot gnu.org
  2015-03-04 12:30 ` ktietz at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-27  0:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Thu Feb 26 21:03:14 2015
New Revision: 221034

URL: https://gcc.gnu.org/viewcvs?rev=221034&root=gcc&view=rev
Log:
    PR tree-optimization/65216
    * tree-ssa-reassoc.c (rewrite_expr_tree): Force creation of
    new stmt and new SSA_NAME for lhs whenever the arguments have
    changed and weren't just swapped.  Fix comment typo.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr65216.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-reassoc.c


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

* [Bug tree-optimization/65216] [5 Regression] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (6 preceding siblings ...)
  2015-02-27  0:12 ` jakub at gcc dot gnu.org
@ 2015-02-27  0:25 ` jakub at gcc dot gnu.org
  2015-03-04 12:30 ` ktietz at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-27  0:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


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

* [Bug tree-optimization/65216] [5 Regression] wrong code at -O3 on x86_64-linux-gnu
  2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (7 preceding siblings ...)
  2015-02-27  0:25 ` jakub at gcc dot gnu.org
@ 2015-03-04 12:30 ` ktietz at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-03-04 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |madars+gccbug at gmail dot com

--- Comment #8 from Kai Tietz <ktietz at gcc dot gnu.org> ---
*** Bug 65307 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2015-03-04 12:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26  1:19 [Bug tree-optimization/65216] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2015-02-26  3:15 ` [Bug tree-optimization/65216] " ktietz at gcc dot gnu.org
2015-02-26  3:45 ` glisse at gcc dot gnu.org
2015-02-26  5:26 ` [Bug tree-optimization/65216] [5 Regression] " ktietz at gcc dot gnu.org
2015-02-26  8:39 ` jakub at gcc dot gnu.org
2015-02-26 10:14 ` rguenth at gcc dot gnu.org
2015-02-26 12:49 ` jakub at gcc dot gnu.org
2015-02-27  0:12 ` jakub at gcc dot gnu.org
2015-02-27  0:25 ` jakub at gcc dot gnu.org
2015-03-04 12:30 ` ktietz 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).