public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59747] New: wrong code at -Os and above on x86_64-linux-gnu in 64-bit mode
@ 2014-01-10  6:19 su at cs dot ucdavis.edu
  2014-01-10  8:48 ` [Bug tree-optimization/59747] [4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-01-10  6:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59747
           Summary: wrong code at -Os and above on x86_64-linux-gnu in
                    64-bit mode
           Product: gcc
           Version: 4.9.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 64-bit mode (but not 32-bit). 

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/4.9.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.9.0 20140109 (experimental) [trunk revision 206472] (GCC) 
$ 
$ gcc-trunk -m64 -O1 small.c; a.out
0
$ gcc-trunk -m32 -Os small.c; a.out
0
$ gcc-4.8 -m64 -Os small.c; a.out
0
$ 
$ gcc-trunk -m64 -Os small.c; a.out
1
$ 


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


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

int a[6], b, c = 1, d;
short e;

void
fn1 (int p)
{
  b = a[p];
}

int
main ()
{
  a[0] = 1;
  if (c)
    e--;
  d = e;
  long long f = e;
  fn1 ((f >> 56) & 1);
  printf ("%d\n", b);
  return 0;
}


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

end of thread, other threads:[~2014-01-16 21:05 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-10  6:19 [Bug tree-optimization/59747] New: wrong code at -Os and above on x86_64-linux-gnu in 64-bit mode su at cs dot ucdavis.edu
2014-01-10  8:48 ` [Bug tree-optimization/59747] [4.9 Regression] " mpolacek at gcc dot gnu.org
2014-01-10 10:05 ` mpolacek at gcc dot gnu.org
2014-01-10 10:17 ` mpolacek at gcc dot gnu.org
2014-01-10 10:58 ` jakub at gcc dot gnu.org
2014-01-10 11:05 ` rguenth at gcc dot gnu.org
2014-01-10 11:08 ` jakub at gcc dot gnu.org
2014-01-10 13:14 ` jakub at gcc dot gnu.org
2014-01-10 16:25 ` law at redhat dot com
2014-01-10 17:14 ` law at redhat dot com
2014-01-10 17:56 ` law at redhat dot com
2014-01-15 13:11 ` trippels at gcc dot gnu.org
2014-01-15 18:14 ` law at redhat dot com
2014-01-15 18:14 ` law at gcc dot gnu.org
2014-01-16 20:11 ` dominiq at lps dot ens.fr
2014-01-16 20:12 ` dominiq at lps dot ens.fr
2014-01-16 20:12 ` dominiq at lps dot ens.fr
2014-01-16 20:20 ` jakub at gcc dot gnu.org
2014-01-16 21:05 ` dominiq at lps dot ens.fr

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).