[PATCH] D125036: [RISCV] Alignment relaxation

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 11 09:59:09 PDT 2022


MaskRay added inline comments.


================
Comment at: lld/ELF/Arch/RISCV.cpp:511
+            AlignAddend aa(bytes, PowerOf2Ceil(bytes + 2));
+            r.addend = aa.u64;
+          }
----------------
This accesses an inactive member of the union and is UB. https://en.cppreference.com/w/cpp/language/union
You can drop `union`, replace `u64` with a member function which returns a uint64_t instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125036



More information about the llvm-commits mailing list