[PATCH] D115103: Leak Sanitizer port to Windows

Clemens Wasser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 11:58:59 PST 2023


clemenswasser added a comment.

@vitalybuka There seems to be a bug in MSVCs bit-field implementation, which causes the `disable.c` test to fail.
This reproducer (assert) passes with gcc and fails with MSVC (`m.tag` is `0xffffffff`):

  cpp
  #include <stdint.h>
  #include <assert.h>
  
  enum ChunkTag {
    kDirectlyLeaked = 0,  // default
    kIndirectlyLeaked = 1,
    kReachable = 2,
    kIgnored = 3
  };
  
  struct ChunkMetadata {
    uint8_t allocated : 8;  // Must be first.
    ChunkTag tag : 2;
    uintptr_t requested_size : 54;
    uint32_t stack_trace_id;
  };
  
  int main() {
      ChunkMetadata m;
      m.tag = kIgnored;
      assert(m.tag == kIgnored);
  }

Do you have a suggestion how I could fix this on MSVC


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

https://reviews.llvm.org/D115103



More information about the cfe-commits mailing list