[PATCH] D140689: [DFSan] Add `zeroext` attribute for callbacks with 8bit shadow variable arguments

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 13:15:30 PST 2022


MaskRay added a comment.

> Some platforms' ABI including LoongArch and RISCV requires unsigned integer data types (except unsigned int) are zero-extended when stored in general-purpose register. So we need to add the zeroext attribute when declaring and calling them.

This is not precise. First, most architectures zero-extend unsigned integer data types... So you change "some" to "many" and drop LoongArch/RISCV.
Second, the problem is that compiler optimization may assume the arguments are zero-extended and, if not, misbehave, e.g. it uses an `i8` argument to index into a jump table. If the argument has non-zero high bits, the output will be wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140689



More information about the llvm-commits mailing list