public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/58726] New: wrong code at -Os on x86_64-linux-gnu (affecting trunk/4.7/4.6, but not 4.8)
@ 2013-10-14 18:38 su at cs dot ucdavis.edu
  2013-10-15  8:22 ` [Bug rtl-optimization/58726] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-10-14 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58726
           Summary: wrong code at -Os on x86_64-linux-gnu (affecting
                    trunk/4.7/4.6, but not 4.8)
           Product: gcc
           Version: 4.8.1
            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 miscompiles the following code on x86_64-linux at -Os in
both 32-bit and 64-bit modes. 

This is a regression from 4.8.x. 

It also affects 4.6.x and 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
--enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-werror
--enable-checking=release --with-gmp=/usr/local/gcc-trunk
--with-mpfr=/usr/local/gcc-trunk --with-mpc=/usr/local/gcc-trunk
--with-cloog=/usr/local/gcc-trunk --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.9.0 20131014 (experimental) [trunk revision 203511] (GCC) 
$ 
$ gcc-trunk -O1 small.c; a.out
-9162
$ gcc-trunk -Os small.c; a.out
-32768
$ 
$ gcc-4.8 -Os small.c; a.out
-9162
$ 
$ gcc-4.7 -Os small.c; a.out
-32768
$ gcc-4.6 -Os small.c; a.out
-32768
$ 

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


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

int a, c;

union
{
  int f1;
  int f2:1;
} b;

short
foo (short p)
{
  return p < 0 ? p : a;
}

int
main ()
{
  b.f1 = 56374;
  unsigned short d;
  int e = b.f2;
  d = e == 0 ? b.f1 : 0;
  c = foo (d);
  printf ("%d\n", c);
  return 0;
}


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

end of thread, other threads:[~2014-10-23  4:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 18:38 [Bug rtl-optimization/58726] New: wrong code at -Os on x86_64-linux-gnu (affecting trunk/4.7/4.6, but not 4.8) su at cs dot ucdavis.edu
2013-10-15  8:22 ` [Bug rtl-optimization/58726] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-10-18 19:55 ` mikpelinux at gmail dot com
2013-11-05 15:03 ` rguenth at gcc dot gnu.org
2013-12-03 19:25 ` jakub at gcc dot gnu.org
2013-12-03 19:51 ` jakub at gcc dot gnu.org
2013-12-04 11:25 ` jakub at gcc dot gnu.org
2013-12-04 15:51 ` jakub at gcc dot gnu.org
2013-12-04 15:56 ` [Bug rtl-optimization/58726] [4.7 " jakub at gcc dot gnu.org
2013-12-11 15:17 ` ebotcazou at gcc dot gnu.org
2014-02-22  8:57 ` ebotcazou at gcc dot gnu.org
2014-10-23  6:08 ` pinskia 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).