[PATCH] D49460: Flush counters before forking to avoid counting the execution before fork twice

Marco Castelluccio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 17:10:07 PDT 2018


marco-c created this revision.
marco-c added a reviewer: davidxl.
Herald added subscribers: Sanitizers, llvm-commits, mgorny.

If we don't flush the counters before `fork`, the counters of the execution up to the `fork` call will be added twice (by both processes).

This fixes https://bugs.llvm.org/show_bug.cgi?id=38180.

There's also another problem that probably should be fixed on the Clang/LLVM side but is not directly related to this patch (even though you can see its effects in the test): after `fork` there should be a separate block (right now everything in main in the test is in the same block).


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49460

Files:
  lib/profile/CMakeLists.txt
  lib/profile/GCDAProfiling.c
  lib/profile/GCDAProfiling.h
  lib/profile/GCDAProfilingInterceptors.cc
  test/profile/Inputs/instrprof-gcov-fork.c
  test/profile/Inputs/instrprof-gcov-fork.c.gcov
  test/profile/Posix/instrprof-gcov-fork.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49460.155992.patch
Type: text/x-patch
Size: 5703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/2df68363/attachment.bin>


More information about the llvm-commits mailing list