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

Richard Smith - zygoloid via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 20 16:22:04 PST 2018


rsmith added inline comments.


================
Comment at: lib/ubsan/ubsan_handlers.cc:133-141
+         "assumption of %0 byte alignment for address %1 of type %2 failed. "
+         "address is %3 byte aligned. misalignment offset is %4 byte")
+        << Alignment << (void *)Pointer << Data->Type << ActualAlignment
+        << MisAlignmentOffset;
+  } else {
+    Diag(Loc, DL_Error, ET,
+         "assumption of %0 byte alignment (with offset of %1 byte) for address "
----------------
ubsan's diagnostic format is intended to be "like a clang diagnostic", so should be a single sentence. How splitting this into an error pointing at the source location ("assumption [...] failed"), and a note pointing at the memory address that the pointer points to ("address is [...] aligned, misalignment offset is [...] bytes")...


================
Comment at: lib/ubsan/ubsan_handlers.cc:149
+
+  Diag(Pointer, DL_Note, ET, "pointer points here");
+
----------------
... and removing this note.


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