public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57347] New: wrong code for bitfield on x86_64-linux at -Os and above
@ 2013-05-20 23:28 dhazeghi at yahoo dot com
  2013-05-21  6:32 ` [Bug rtl-optimization/57347] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-05-20 23:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57347
           Summary: wrong code for bitfield on x86_64-linux at -Os and
                    above
           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 on x86_64-linux with gcc trunk and 4.8 at -Os
and above optimization level.  It works correctly with gcc 4.7 (outputs 1).

$ gcc-trunk -v
gcc version 4.9.0 20130520 (experimental) [trunk revision 199099] (GCC) 
$ gcc-trunk -O1 wrong.c 
$ ./a.out 
1
$ gcc-4.7 -Os wrong.c 
$ ./a.out 
1
$ gcc-trunk -Os wrong.c 
$ ./a.out 
0
$

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

struct S1 {
  int f0;
  int f1 : 10;
  int f2 : 13;
};

int i;
int *j = &i;

static void foo(struct S1 s) {
  int *p;
  int l[88];
  int **pp = &p;
  *pp = &l[1];
  l[0] = 1;
  *j = 1 && s.f2;
}

int main(void) {
  struct S1 s = { 0, 0, 1 };
  foo(s);
  printf("%d\n", i);
  return 0;
}


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

end of thread, other threads:[~2013-05-23 13:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-20 23:28 [Bug rtl-optimization/57347] New: wrong code for bitfield on x86_64-linux at -Os and above dhazeghi at yahoo dot com
2013-05-21  6:32 ` [Bug rtl-optimization/57347] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
2013-05-21 12:26 ` jakub at gcc dot gnu.org
2013-05-21 13:47 ` jamborm at gcc dot gnu.org
2013-05-23 13:47 ` [Bug middle-end/57347] " jamborm at gcc dot gnu.org
2013-05-23 13:47 ` jamborm 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).