public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59715] New: wrong code at -Os and above on x86_64-linux-gnu
@ 2014-01-08  6:37 su at cs dot ucdavis.edu
  2014-01-08  6:58 ` [Bug tree-optimization/59715] " steven at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-01-08  6:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59715
           Summary: wrong code at -Os and above on x86_64-linux-gnu
           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 (as well as 4.8.x and 4.7.x) miscompiles the following
code on x86_64-linux at -Os and above in both 32-bit and 64-bit modes.

This is a regression from 4.6.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 20140107 (experimental) [trunk revision 206387] (GCC) 
$ 
$ gcc-trunk -O1 small.c; a.out
0
$ gcc-4.6 -Os small.c; a.out
0
$ gcc-trunk -Os small.c; a.out
2
$ gcc-4.8 -Os small.c; a.out
2
$ gcc-4.7 -Os small.c; a.out
2
$ 


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


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

int a = 2, b;

int
main ()
{
  int c;
  if (!b)
    {
      b = a;
      c = a == 0 ? 1 : 1 % a;
      if (c)
    b = 0;
    }
  printf ("%d\n", b);
  return 0;
}


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

end of thread, other threads:[~2014-05-07 10:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08  6:37 [Bug tree-optimization/59715] New: wrong code at -Os and above on x86_64-linux-gnu su at cs dot ucdavis.edu
2014-01-08  6:58 ` [Bug tree-optimization/59715] " steven at gcc dot gnu.org
2014-01-08  7:07 ` jakub at gcc dot gnu.org
2014-01-08  7:12 ` [Bug tree-optimization/59715] [4.7/4.8/4.9 Regression] " jakub at gcc dot gnu.org
2014-01-08  9:06 ` steven at gcc dot gnu.org
2014-01-08 11:08 ` vries at gcc dot gnu.org
2014-01-08 11:46 ` rguenth at gcc dot gnu.org
2014-01-08 12:32 ` rguenth at gcc dot gnu.org
2014-01-08 13:08 ` rguenth at gcc dot gnu.org
2014-01-08 13:54 ` rguenth at gcc dot gnu.org
2014-01-08 14:20 ` rguenth at gcc dot gnu.org
2014-01-09  9:21 ` rguenth at gcc dot gnu.org
2014-01-09  9:30 ` [Bug tree-optimization/59715] [4.7/4.8 " rguenth at gcc dot gnu.org
2014-01-10  8:37 ` rguenth at gcc dot gnu.org
2014-05-07 10:02 ` [Bug tree-optimization/59715] [4.7 " rguenth at gcc dot gnu.org
2014-05-07 10:07 ` rguenth 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).