[Bug tree-optimization/79737] [7 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 28 09:09:00 GMT 2017


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
#pragma pack(1)
struct S
{
  int b:18;
  int c:1;
  int d:24;
  int e:15;
  int f:14;
} i, j;

void
foo ()
{
  i.e = 0;
  i.b = 5;
  i.c = 0;
  i.d = -5;
  i.f = 5;
}

void
bar ()
{
  j.b = 5;
  j.c = 0;
  j.d = -5;
  j.e = 0;
  j.f = 5;
}

int
main ()
{
  if (i.b != j.b || i.c != j.c || i.d != j.d || i.e != j.e || i.f != j.f)
    __builtin_abort ();
}

Testcase showing the difference, each function writes a different value while
it should write the same.


More information about the Gcc-bugs mailing list