Files
RossWang 6abc10e1c1 compat: fix crash on MSVC build
Error message: stack around the variable dataout_read_index corruppted

Cause: MSVC stdatomic stack and struct corruption

Historically, the custom compatibility header for MSVC defined
stdatomic helper functions that were not type-generic.

Specifically:
- atomic_compare_exchange_weak was hardcoded to a 64-bit operation
  using InterlockedCompareExchange64 on intptr_t* expected values.
  When called with a 32-bit atomic_ulong (e.g. dataout_fifo_queue_read_index),
  this performed a 64-bit write starting at a 32-bit address,
  causing stack and adjacent structure corruption on 64-bit systems.
- atomic_load, atomic_store, atomic_fetch_add, and atomic_fetch_sub
  were hardcoded to 32-bit LONG operations, causing silent data
  truncation when used on 64-bit atomic_uint_fast64_t variables.

Fix these issues by wrapping all interlocked helper functions
with type-generic macro dispatches using compile-time sizeof(*(p_a))
branching, safely routing to either 32-bit or 64-bit versions of
the Windows Interlocked APIs.
2026-05-23 14:14:42 +08:00
..
2021-11-17 13:09:44 +00:00
2026-05-23 14:14:42 +08:00