public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57569] New: wrong code for struct copy at -O3 on x86_64-linux
@ 2013-06-08 19:25 dhazeghi at yahoo dot com
  2013-06-08 20:11 ` [Bug rtl-optimization/57569] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-06-08 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57569
           Summary: wrong code for struct copy at -O3 on x86_64-linux
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dhazeghi at yahoo dot com

The following code is miscompiled with current gcc-trunk on x86_64-linux at -O3
optimization level in 32-bit mode, outputting garbage (rather than 0).  This is
a regression from 4.7.

$ gcc-trunk -v
gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) 
$ gcc-trunk -O2 -m32 reduced.c 
$ ./a.out 
0
$ gcc-4.7 -O3 -m32 reduced.c 
$ ./a.out 
0
$ gcc-trunk -O3 -m32 reduced.c 
$ ./a.out 
134519796
----------------------------
int printf (const char *, ...);

struct S { int f0; } a; 

int b, e, *d = &b, f;

void 
fn1 ()
{
  int **g[9][6];
  int ***h = &g[6][3];
  for (; e < 9; e++) {
    f = 0;
    for (; f < 6; f++)
      g[e][f] = &d;
  }
  ***h = 0;
}

void
fn2 ()
{
  fn1 ();
  struct S c[4][10] = {};
  a = c[3][9];
}

int
main ()
{
  fn2 ();
  printf ("%d\n", a.f0);
  return 0;
}


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

end of thread, other threads:[~2014-12-20 15:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-08 19:25 [Bug rtl-optimization/57569] New: wrong code for struct copy at -O3 on x86_64-linux dhazeghi at yahoo dot com
2013-06-08 20:11 ` [Bug rtl-optimization/57569] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
2013-06-10 15:22 ` matz at gcc dot gnu.org
2013-06-11 14:18 ` matz at gcc dot gnu.org
2013-06-16 13:38 ` amylaar at gcc dot gnu.org
2013-10-16  9:50 ` jakub at gcc dot gnu.org
2013-10-30 12:56 ` [Bug rtl-optimization/57569] [4.8 " rguenth at gcc dot gnu.org
2014-03-17 15:32 ` wschmidt at gcc dot gnu.org
2014-05-22  9:02 ` rguenth at gcc dot gnu.org
2014-12-19 13:40 ` jakub at gcc dot gnu.org
2014-12-20 13:51 ` mikpelinux at gmail dot com
2014-12-20 15:54 ` jakub 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).