https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108552
--- Comment #29 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #27) > Well, we could in -fprofile-update=single (or perhaps in a new single-like > mode) mark the gcov artificial vars volatile or with some flag that would at > least cause reload not to reread values from memory. The profiling would be > still racy, but at the expense of somewhat slower code (with volatile more, > with special flag less so) slightly less so (as it would e.g. prevent the > compiler from avoiding the rereads). Though, e.g. volatile would then prevent say on x86 using inc directly on the memory location, which is used in the -fprofile-update=atomic mode (with additional lock).