[PATCH] D54590: [compiler-rt][UBSan] Sanitization for alignment assumptions.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 14 10:32:21 PST 2019


lebedev.ri marked an inline comment as done.
lebedev.ri added a subscriber: rjmccall.
lebedev.ri added a comment.

Oh yay, thank you for the review!



================
Comment at: test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-lvalue.cpp:23
+  struct ac_struct x;
+  x.a = argv; // FIXME: it is weird that this does not also have an assumption.
+  load_from_ac_struct(&x);
----------------
morehouse wrote:
> Any idea why the assignment doesn't trigger a report while the unused return value does?
Because no alignment assumption is being emitted in that case.

The question is, given such a cast that increases the alignment,
if the run-time check is to fail, is the cast is itself UB already,
or is it UB to use the resulting mis-aligned pointer?
(CC @rjmccall, @rsmith)

Regardless, this is mainly a question for a clang side,
and i think it can be addressed as a follow-up.



Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D54590





More information about the llvm-commits mailing list