[PATCH] D45321: [atomics] Fix runtime calls for misaligned atomics

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 07:31:29 PDT 2018


dvyukov added a comment.

> Atomics accessed via C11 _Atomic and C++11 std::atomic will be suitably aligned, but there's a reasonable amount of legacy code that uses the GCC builtins on non-atomic types (of unknown alignment) and this is what Clang uses to implement those accesses when they come up.

This is illegal, right?
Even non-atomic accesses can fail and be miscompiled for unaligned variables, no?
For example, I would assume that "(uintptr_t)ptr % 4 == 0" where ptr come from an unmarked int will be evaluated to a compile-time true.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D45321





More information about the llvm-commits mailing list