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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-11-21
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |ktkachov at gcc dot gnu.org
   Target Milestone|---                         |7.0
            Summary|incorrect write to          |[7 Regression] incorrect
                   |larger-than-type bitfield   |write to larger-than-type
                   |(signed char x:9)           |bitfield (signed char x:9)
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with the introduction of the store merging pass: r241649.
struct S {
  long int : 23;
  long int a : 24;
  long int b : 10;
  long int c : 24;
  signed char d : 9;
} s;

__attribute__((noinline, noclone)) void
foo ()
{
  s.d = 0;
  s.c = -1193165L;
}

int
main ()
{
  foo ();
  if (s.d != 0)
    __builtin_abort ();
  return 0;
}

store-merging pass turns:
  s.d = 0;
  s.c = -1193165;
into:
  MEM[(struct S *)&s + 8B] = 4293774131;

Reply via email to