public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/58956] New: wrong code at -O1 and above (affecting gcc 4.6 to trunk)
@ 2013-11-01  5:14 su at cs dot ucdavis.edu
  2013-11-01  8:34 ` [Bug tree-optimization/58956] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-11-01  5:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58956
           Summary: wrong code at -O1 and above (affecting gcc 4.6 to
                    trunk)
           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 gcc 4.6.x, 4.7.x, and 4.8.x) produces wrong
code for the following testcase on x86_64-linux-gnu when compiled at -O1 and
above in 64-bit mode. 

$ 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=none --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 20131031 (experimental) [trunk revision 204248] (GCC) 
$ 
$ gcc-trunk -O0 small.c; a.out
1
$ gcc-trunk -O1 small.c; a.out
0
$ gcc-4.8 -O1 small.c; a.out
0
$ gcc-4.7 -O1 small.c; a.out
0
$ gcc-4.6 -O1 small.c; a.out
0
$ 
$ clang-trunk -O1 small.c; a.out
1
$ icc -O1 small.c; a.out
1
$ 


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


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

struct S
{
  int f0;
} a = {1}, b, g, *c = &b, **f = &c;

int *d, **e = &d, h;

void __assert_fail ();

struct S
foo ()
{
  *e = &h;
  if (!d) 
    __assert_fail ();
  *f = &g;
  return a;
}

int
main ()
{
  struct S *i = c;
  *i = foo ();
  printf ("%d\n", b.f0);
  return 0;
}


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

end of thread, other threads:[~2014-06-12 13:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01  5:14 [Bug tree-optimization/58956] New: wrong code at -O1 and above (affecting gcc 4.6 to trunk) su at cs dot ucdavis.edu
2013-11-01  8:34 ` [Bug tree-optimization/58956] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
2013-11-04 14:37 ` rguenth at gcc dot gnu.org
2013-11-09 21:56 ` mikpelinux at gmail dot com
2013-11-19 10:44 ` [Bug middle-end/58956] " rguenth at gcc dot gnu.org
2013-11-19 11:09 ` rguenth at gcc dot gnu.org
2013-11-19 13:28 ` rguenth at gcc dot gnu.org
2013-11-19 13:29 ` [Bug middle-end/58956] [4.7/4.8 " rguenth at gcc dot gnu.org
2013-12-05 13:10 ` rguenth at gcc dot gnu.org
2013-12-16  8:09 ` [Bug middle-end/58956] [4.7 " jakub at gcc dot gnu.org
2014-01-07 16:49 ` jakub at gcc dot gnu.org
2014-01-08 10:14 ` hp at gcc dot gnu.org
2014-01-08 10:22 ` rguenth at gcc dot gnu.org
2014-06-12 13:31 ` 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).