public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60116] New: wrong code at -Os on x86_64-linux-gnu in 32-bit mode
@ 2014-02-08  7:26 su at cs dot ucdavis.edu
  2014-02-08  9:28 ` [Bug target/60116] [4.8/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-02-08  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60116
           Summary: wrong code at -Os on x86_64-linux-gnu in 32-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 and 4.8.x mis-compile the following code on x86_64-linux
at -Os in 32-bit mode (but not 64-bit).

This is a regression from 4.7.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 20140207 (experimental) [trunk revision 207610] (GCC) 
$ 
$ gcc-trunk -m32 -O1 small.c; a.out
1
$ gcc-trunk -m64 -Os small.c; a.out
1
$ gcc-4.7.3 -m32 -Os small.c; a.out
1
$ 
$ gcc-trunk -m32 -Os small.c; a.out
0
$ gcc-4.8.2 -m32 -Os small.c; a.out
0
$ 


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


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

int a, b, c, d = 1, e, f = 1, h, i, k;
char g, j;

int
fn1 ()
{
  int l;
  e = 0;
  c = 0;
  for (;;)
    {
      k = a && b;
      j = k * 54;
      g = j * 147;
      l = ~g + (long long) e && 1;
      if (d)
    c = l;
      else
    h = i = l * 9UL;
      if (f)
    return 0;
    }
}

int
main ()
{
  fn1 ();
  printf ("%d\n", c);
  return 0;
}


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

end of thread, other threads:[~2014-02-12 10:17 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-08  7:26 [Bug tree-optimization/60116] New: wrong code at -Os on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
2014-02-08  9:28 ` [Bug target/60116] [4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
2014-02-09 18:04 ` ubizjak at gmail dot com
2014-02-09 20:19 ` jakub at gcc dot gnu.org
2014-02-09 21:13 ` glisse at gcc dot gnu.org
2014-02-09 21:17 ` mpolacek at gcc dot gnu.org
2014-02-09 21:26 ` ubizjak at gmail dot com
2014-02-09 21:38 ` glisse at gcc dot gnu.org
2014-02-09 21:51 ` glisse at gcc dot gnu.org
2014-02-10  9:21 ` ubizjak at gmail dot com
2014-02-10  9:44 ` [Bug rtl-optimization/60116] " rguenth at gcc dot gnu.org
2014-02-10 16:48 ` jakub at gcc dot gnu.org
2014-02-10 17:16 ` jakub at gcc dot gnu.org
2014-02-10 18:24 ` ebotcazou at gcc dot gnu.org
2014-02-12  8:50 ` ebotcazou at gcc dot gnu.org
2014-02-12  8:52 ` ebotcazou at gcc dot gnu.org
2014-02-12  8:53 ` ebotcazou at gcc dot gnu.org
2014-02-12 10:17 ` ebotcazou at gcc dot gnu.org
2014-02-12 10:17 ` ebotcazou 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).