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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |6.1.0
   Target Milestone|---                         |7.0
            Summary|[Regression 7] Incorrect    |[7 Regression] Incorrect
                   |arithmetic optimization     |arithmetic optimization
                   |involving bitfield          |involving bitfield
                   |arguments                   |arguments

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
C testcase:

struct struct_1 {
    unsigned int m1 : 6 ;
    unsigned int m2 : 24 ;
    unsigned int m3 : 6 ;
};

unsigned short var_32 = 0x2d10;

struct struct_1 s1;

void init () {
    s1.m1 = 4;
    s1.m2 = 0x7ca4b8;
    s1.m3 = 24;
}

void foo () {
  unsigned int c =
   // 0x7ca4b8 * -(24)
   ((unsigned int) s1.m2) * (-((unsigned int) s1.m3))
   +
   // 0x2d10 * -(4) = 0xb440
   (var_32) * (-((unsigned int) (s1.m1)));

  if (c != 4098873984)
    __builtin_abort ();
}

int main () {
    init ();
    foo ();
    return 0;
}

Reply via email to