[PATCH] D128501: [CodeGen] Make uninitialized Lvalue bit-field stores poison compatible

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 27 13:10:44 PDT 2022


efriedma added a comment.

> No, you can still link those. There's no ABI change nor any interference at IR level.

The scenario I was thinking of with -ffine-grained-bitfield-accesses is something like the following:

File A:

  struct X { int a : 8; int b : 24; };
  void f(struct X*);
  int g() {
      struct X x;
      x.a = 10;
      f(&x);
      return x.a;
  }

File B:

  struct X { int a : 8; int b : 24; };
  void f(struct X* x) {
      x->b = 10;
  }

If both files are compiled -ffine-grained-bitfield-accesses, the fields don't overlap.  If both files are compiled with -fno-fine-grained-bitfield-accesses, the assignment in file A freezes both fields of "x".  If file A is compiled with -ffine-grained-bitfield-accesses, but file B is not, f() corrupts the field "a", so g() returns poison (if I'm not missing anything?).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128501/new/

https://reviews.llvm.org/D128501



More information about the cfe-commits mailing list