public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45695]  New: -O1 wrong-code by cmove
@ 2010-09-16 21:38 jan dot kratochvil at redhat dot com
  2010-09-16 21:57 ` [Bug c/45695] " jakub at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2010-09-16 21:38 UTC (permalink / raw)
  To: gcc-bugs

FSF GDB HEAD by FSF GCC 4.5.HEAD errors on `print 0|0' with -O1 and higher.

source below compiles to:
0000000000400455 <f>:
  400455:       53                      push   %rbx
  400456:       39 fa                   cmp    %edi,%edx
  400458:       0f 44 de                cmove  %esi,%ebx

but $ebx is left uninitialized for not-equal comparison.

Compilation flags: -O1
it passes = exit code 0 = with -O0
it fails  = exit code 1 = with -O1

PASS: gcc (GCC) 4.4.5 20100916 (prerelease)
FAIL: gcc (GCC) 4.5.2 20100916 (prerelease)
PASS: gcc (GCC) 4.6.0 20100916 (experimental)
FAIL: gcc-4.5.1-3.fc14.x86_64
not re-verified but PASS: gcc-4.5.1-1.fc14.x86_64


__attribute__((noinline, noclone)) void
g (int x)
{ 
  asm volatile ("");
}
__attribute__((noinline, noclone)) int
f (int a, int b, int d)
{
  int r = -1;
  b += d;
  if (d == a)
    r = b - d;
  g (b);
  return r; 
}
int 
main (void)
{ 
  asm volatile ("mov $42, %%rbx" : : : "rbx");
  return f (0, 1, 4) == 42 ? 1 : 0;
}


-- 
           Summary: -O1 wrong-code by cmove
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug c/45695] -O1 wrong-code by cmove
  2010-09-16 21:38 [Bug c/45695] New: -O1 wrong-code by cmove jan dot kratochvil at redhat dot com
@ 2010-09-16 21:57 ` jakub at gcc dot gnu dot org
  2010-09-17  9:44 ` [Bug rtl-optimization/45695] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-16 21:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-09-16 21:57 -------
Caused by my http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163555
change, so will look into it tomorrow.
http://gcc.gnu.org/bugzilla/attachment.cgi?id=21560&action=view
doesn't break it, only the version that tries harder and tries it the other way
around.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-16 21:57:25
               date|                            |


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


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

* [Bug rtl-optimization/45695] [4.5/4.6 Regression] -O1 wrong-code by cmove
  2010-09-16 21:38 [Bug c/45695] New: -O1 wrong-code by cmove jan dot kratochvil at redhat dot com
  2010-09-16 21:57 ` [Bug c/45695] " jakub at gcc dot gnu dot org
@ 2010-09-17  9:44 ` rguenth at gcc dot gnu dot org
  2010-09-17 12:05 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-17  9:44 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |rtl-optimization
      Known to work|                            |4.5.1
           Priority|P3                          |P1
            Summary|-O1 wrong-code by cmove     |[4.5/4.6 Regression] -O1
                   |                            |wrong-code by cmove
   Target Milestone|---                         |4.5.2


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


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

* [Bug rtl-optimization/45695] [4.5/4.6 Regression] -O1 wrong-code by cmove
  2010-09-16 21:38 [Bug c/45695] New: -O1 wrong-code by cmove jan dot kratochvil at redhat dot com
  2010-09-16 21:57 ` [Bug c/45695] " jakub at gcc dot gnu dot org
  2010-09-17  9:44 ` [Bug rtl-optimization/45695] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
@ 2010-09-17 12:05 ` jakub at gcc dot gnu dot org
  2010-09-20 13:25 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-17 12:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-09-17 12:05 -------
Created an attachment (id=21817)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21817&action=view)
gcc46-pr45695.patch

Untested fix.


-- 


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


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

* [Bug rtl-optimization/45695] [4.5/4.6 Regression] -O1 wrong-code by cmove
  2010-09-16 21:38 [Bug c/45695] New: -O1 wrong-code by cmove jan dot kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2010-09-17 12:05 ` jakub at gcc dot gnu dot org
@ 2010-09-20 13:25 ` jakub at gcc dot gnu dot org
  2010-09-20 22:38 ` jakub at gcc dot gnu dot org
  2010-09-20 22:40 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-20 13:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-09-20 13:24 -------
Subject: Bug 45695

Author: jakub
Date: Mon Sep 20 13:24:23 2010
New Revision: 164431

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164431
Log:
        PR rtl-optimization/45695
        * combine.c (try_combine): When splitting a two set pattern,
        make sure the pattern which will be put into i2 doesn't use REGs
        or MEMs set by insns in between i2 and i3.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr45695.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug rtl-optimization/45695] [4.5/4.6 Regression] -O1 wrong-code by cmove
  2010-09-16 21:38 [Bug c/45695] New: -O1 wrong-code by cmove jan dot kratochvil at redhat dot com
                   ` (3 preceding siblings ...)
  2010-09-20 13:25 ` jakub at gcc dot gnu dot org
@ 2010-09-20 22:38 ` jakub at gcc dot gnu dot org
  2010-09-20 22:40 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-20 22:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2010-09-20 22:37 -------
Subject: Bug 45695

Author: jakub
Date: Mon Sep 20 22:37:32 2010
New Revision: 164467

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164467
Log:
        PR rtl-optimization/45695
        * combine.c (try_combine): Don't try to swap the two patterns, if the
        chosen order is not possible, just give up.  For HAVE_cc0 targets,
        check if XVECEXP (newpat, 0, 0) doesn't use REGs or MEMs set by insns
        in between i2 and i3.

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

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/pr45695.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/combine.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug rtl-optimization/45695] [4.5/4.6 Regression] -O1 wrong-code by cmove
  2010-09-16 21:38 [Bug c/45695] New: -O1 wrong-code by cmove jan dot kratochvil at redhat dot com
                   ` (4 preceding siblings ...)
  2010-09-20 22:38 ` jakub at gcc dot gnu dot org
@ 2010-09-20 22:40 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-20 22:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2010-09-20 22:39 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-09-20 22:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-16 21:38 [Bug c/45695] New: -O1 wrong-code by cmove jan dot kratochvil at redhat dot com
2010-09-16 21:57 ` [Bug c/45695] " jakub at gcc dot gnu dot org
2010-09-17  9:44 ` [Bug rtl-optimization/45695] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
2010-09-17 12:05 ` jakub at gcc dot gnu dot org
2010-09-20 13:25 ` jakub at gcc dot gnu dot org
2010-09-20 22:38 ` jakub at gcc dot gnu dot org
2010-09-20 22:40 ` jakub at gcc dot gnu dot 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).