https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85351
Fangrui Song <i at maskray dot me> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |i at maskray dot me --- Comment #5 from Fangrui Song <i at maskray dot me> --- I am a bit curious how GCC instruments such functions which may alter control flows * exit/execve/execl/etc * fork * functions which may throw or call any above functions If you force a split basic block after such functions, you get counts correct but you pay the costs that there is one more basic block and two more arcs. In -fprofile-arcs you need to pay the instrumentation cost of one arc (after taking into account of the Kirchhoff circuit law's spanning tree optimization). If you assume every external function call may alter control flows, you pay rather large overhead for things you probably care little (since I know some underlying mechanism I don't trust line counts after special functions).