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

            Bug ID: 123894
           Summary: bpf: incorrectly eliding bitfiled extraction
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: vineetg at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
  Target Milestone: ---
            Target: bpf-unknown-none

typedef struct  {
  int a;
  char b : 5;
} __attribute__((preserve_access_index)) my_t;

char foo(my_t *s)
{
  return s->b;
}

gcc: -O2 -mco-re -gbtf -fms-extensions

  foo:
        r0 = *(u8 *) (r1+4)
        exit

llvm: -O2 --target=bpfel
  foo:
        w0 = *(u8 *)(r1 + 4)
        w0 <<= 27
        w0 s>>= 27
        exit

Reply via email to