public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/63551] New: wrong code (segfaults) at -Os on x86_64-linux-gnu
@ 2014-10-16  4:41 su at cs dot ucdavis.edu
  2014-10-16  9:47 ` [Bug tree-optimization/63551] [4.9/5 Regression] " rguenth at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-10-16  4:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63551
           Summary: wrong code (segfaults) at -Os on x86_64-linux-gnu
           Product: gcc
           Version: 5.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.9.x) 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. 

$ 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 20141014 (experimental) [trunk revision 216217] (GCC) 
$ 
$ gcc-trunk -O1 small.c; a.out
$ 
$ gcc-trunk -Os small.c
$ ./a.out
Segmentation fault (core dumped)
$ 

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

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

int a, d;

void
fn1 (union U p)
{
  if (p.f1 <= 0)
    if (a)
      d = 0; 
}

void
fn2 ()
{
  d = 0; 
  union U b = { 4294967286 };
  fn1 (b);
}

int
main ()
{
  fn2 ();
  return 0;
}


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

end of thread, other threads:[~2015-04-30 18:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16  4:41 [Bug tree-optimization/63551] New: wrong code (segfaults) at -Os on x86_64-linux-gnu su at cs dot ucdavis.edu
2014-10-16  9:47 ` [Bug tree-optimization/63551] [4.9/5 Regression] " rguenth at gcc dot gnu.org
2014-10-16  9:50 ` rguenth at gcc dot gnu.org
2014-11-18 15:00 ` jakub at gcc dot gnu.org
2014-11-20 12:25 ` rguenth at gcc dot gnu.org
2014-11-21 15:11 ` jamborm at gcc dot gnu.org
2014-11-21 20:16 ` jamborm at gcc dot gnu.org
2014-12-01 12:06 ` jamborm at gcc dot gnu.org
2014-12-01 12:53 ` jamborm at gcc dot gnu.org
2014-12-01 14:05 ` jamborm at gcc dot gnu.org
2014-12-03 15:20 ` jamborm at gcc dot gnu.org
2014-12-13  9:49 ` jakub at gcc dot gnu.org
2014-12-15  9:01 ` jamborm at gcc dot gnu.org
2014-12-15 10:45 ` jakub at gcc dot gnu.org
2015-04-30 18:01 ` mpolacek at gcc dot gnu.org
2015-04-30 18:04 ` mpolacek at gcc dot gnu.org
2015-04-30 18:06 ` mpolacek at gcc dot gnu.org
2015-04-30 18:42 ` mpolacek 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).