public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/64041] New: wrong code at -O2 and -O3 on x86_64-linux-gnu
@ 2014-11-24  7:15 su at cs dot ucdavis.edu
  2014-11-24  8:17 ` [Bug rtl-optimization/64041] [4.9/5 Regression] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-11-24  7:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64041
           Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk and 4.9.x miscompile the following code on x86_64-linux
at -O2 and -O3 in both 32-bit and 64-bit modes. 

This is a regression from 4.8.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 20141122 (experimental) [trunk revision 217971] (GCC) 

$ gcc-trunk -Os small.c; a.out
0
$ gcc-4.8 -O2 small.c; a.out
0
$ 
$ gcc-trunk -O2 small.c; a.out
$ gcc-4.9 -O2 small.c; a.out
$ 

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

int printf (const char *, ...);

int a, b = 1, d;

union U1
{
  unsigned int f0;
  int f1;
};

union U2
{
  int f2;
  int f3;
} c;

int
fn1 (int p)
{
  int t = p && a || p && a && p; 
  return t ? t : a;
}

unsigned
fn2 (union U1 p1, union U2 p2)
{
  if (p1.f1 <= 0)
    {
      for (; p2.f2;)
    c.f2 = 0;
      p2.f2 = fn1 (d);
    }
  return p2.f3;
}

int
main ()
{
  if (b)
    {
      union U1 f = { 0xFFFFFFFFU }; 
      fn2 (f, c);
    }
  printf ("%d\n", 0);
  return 0; 
}


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

* [Bug rtl-optimization/64041] [4.9/5 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu
  2014-11-24  7:15 [Bug rtl-optimization/64041] New: wrong code at -O2 and -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2014-11-24  8:17 ` jakub at gcc dot gnu.org
  2014-11-24 10:59 ` rguenth at gcc dot gnu.org
  2014-11-25 17:37 ` jamborm at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-11-24  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-24
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.9.3
            Summary|wrong code at -O2 and -O3   |[4.9/5 Regression] wrong
                   |on x86_64-linux-gnu         |code at -O2 and -O3 on
                   |                            |x86_64-linux-gnu
     Ever confirmed|0                           |1

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


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

* [Bug rtl-optimization/64041] [4.9/5 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu
  2014-11-24  7:15 [Bug rtl-optimization/64041] New: wrong code at -O2 and -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2014-11-24  8:17 ` [Bug rtl-optimization/64041] [4.9/5 Regression] " jakub at gcc dot gnu.org
@ 2014-11-24 10:59 ` rguenth at gcc dot gnu.org
  2014-11-25 17:37 ` jamborm at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-24 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P1
                 CC|                            |jamborm at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It looks similar to the signed/unsigned IPA CP issue.


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

* [Bug rtl-optimization/64041] [4.9/5 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu
  2014-11-24  7:15 [Bug rtl-optimization/64041] New: wrong code at -O2 and -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2014-11-24  8:17 ` [Bug rtl-optimization/64041] [4.9/5 Regression] " jakub at gcc dot gnu.org
  2014-11-24 10:59 ` rguenth at gcc dot gnu.org
@ 2014-11-25 17:37 ` jamborm at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-11-25 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> It looks similar to the signed/unsigned IPA CP issue.

Indeed, I have added this testcase to the patch.

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


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

end of thread, other threads:[~2014-11-25 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24  7:15 [Bug rtl-optimization/64041] New: wrong code at -O2 and -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2014-11-24  8:17 ` [Bug rtl-optimization/64041] [4.9/5 Regression] " jakub at gcc dot gnu.org
2014-11-24 10:59 ` rguenth at gcc dot gnu.org
2014-11-25 17:37 ` jamborm 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).