public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/58640] New: wrong code (segfaults) at -O3 on x86_64-linux-gnu
@ 2013-10-06  5:23 su at cs dot ucdavis.edu
  2013-10-06 12:31 ` [Bug tree-optimization/58640] " mikpelinux at gmail dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-10-06  5:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58640
           Summary: wrong code (segfaults) at -O3 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 mis-compiles the following code on x86_64-linux at -O3 in
both 32-bit and 64-bit modes, resulting in a segfault. 

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
--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 20131005 (experimental) [trunk revision 203223] (GCC) 
$ 
$ gcc-trunk -O2 small.c; a.out
$ gcc-4.8 -O3 small.c; a.out
$ gcc-trunk -O3 small.c; a.out
Segmentation fault (core dumped)
$ 


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


int a, b, c, d = 1, e;

static signed char
foo ()
{
  int f, g = a;

  for (f = 1; f < 3; f++)
    for (; b < 1; b++)
      {
        if (d)
          for (c = 0; c < 4; c++)
            for (f = 0; f < 3; f++)
              {
                for (e = 0; e < 1; e++)
                  a = g;
                if (f)
                  break;
              }
        else if (f)
          continue;
        return 0;
      }
  return 0;
}

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


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

end of thread, other threads:[~2013-12-10 11:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-06  5:23 [Bug tree-optimization/58640] New: wrong code (segfaults) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2013-10-06 12:31 ` [Bug tree-optimization/58640] " mikpelinux at gmail dot com
2013-10-10 11:59 ` [Bug tree-optimization/58640] [4.9 Regression] " rguenth at gcc dot gnu.org
2013-10-10 19:23 ` law at redhat dot com
2013-10-10 20:09 ` law at redhat dot com
2013-10-10 20:47 ` law at redhat dot com
2013-10-11  3:07 ` law at redhat dot com
2013-10-11 20:31 ` law at gcc dot gnu.org
2013-10-11 20:32 ` law at redhat dot com
2013-10-12  0:56 ` su at cs dot ucdavis.edu
2013-10-14  9:15 ` rguenth at gcc dot gnu.org
2013-10-14  9:17 ` rguenth at gcc dot gnu.org
2013-11-09  6:02 ` law at redhat dot com
2013-12-08 17:05 ` olegendo at gcc dot gnu.org
2013-12-10  6:55 ` law at redhat dot com
2013-12-10 11:20 ` olegendo 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).