[PATCH] D133157: Add -fsanitizer-coverage=control-flow

Kostya Serebryany via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 14 14:43:20 PDT 2022


kcc added inline comments.


================
Comment at: compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp:24
+int main() {
+  int (*main_ptr)() = &main;
+  void (*foo_ptr)(int) = &foo;
----------------
syntax nit:
  auto main_ptr = &main


================
Comment at: compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp:33
+
+  printf("Control Flow section boundaries: [%p %p)\n", CFS_BEG, CFS_END);
+  uintptr_t *pt = CFS_BEG;
----------------
I suggest you move this to a separate function, called from main()


================
Comment at: compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp:67
+// CHECK: Control Flow section boundaries
+// CHECK: Saw the foo().
+// CHECK: Saw the main().
----------------
I don't think you are guaranteed to have main and foo in this order, and similarly dir vs indir call in this order. 
So, use CHECK-DAG instead of CHECK for these four lines. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133157



More information about the cfe-commits mailing list