From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E9A1E3858C50; Sun, 29 Jan 2023 10:08:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9A1E3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674986913; bh=Hc4bfHaT6etYd76GfdvEl9r/SCyIKaMx9eu7I1w4VZE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MvIOIW9vep2p56nw5YfpITwhYoFrGU6hgmtcnhakml2+t0v8ILjsEacFuauQOgjDO RE+dh3VQ1FZZpfCrvVheYCHkewKK3nu2BognvCzzkGEBKrBBuo3a+otgSSXRRNFX7j iTLczg22GkfPk5L5TbRnY/2oemo4+9OFAOOqzxLQ= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108552] Linux i386 kernel 5.14 memory corruption for pre_compound_page() when gcov is enabled Date: Sun, 29 Jan 2023 10:08:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108552 --- Comment #40 from Jakub Jelinek --- (In reply to Jan Hubicka from comment #39) > I was wonering if we should not provide flag to turn all counts > volatile. That way we will still have race conditions on their updates > (and it would be chepaer than atomic) but we won't run into such wrong > code issues nor large profile mismatches. Yes, see above. Or a mode in which we would just avoid hoisting and sinking the gcov vars but keep them non-volatile. Or both. But I guess it would be nice to get Vlad's patch into trunk and release branches for now (perhaps with an extra check for startswith "__gcov" on DECL_NAME, so that we don't do it for the Fortran tokens). As for the patch, just small nits, I think get_base_address returns always non-NULL, so it could be if (tree expr =3D MEM_EXPR (res)) { expr =3D get_base_address (expr); if (VAR_P (expr) && DECL_NONALIASED (expr) && DECL_NAME (expr)) { const char *name =3D IDENTIFIER_POINTER (DECL_NAME (expr)); /* Don't reread coverage counters from memory, if single update model is used in threaded code, other threads could change the counters concurrently. See PR108552. */ if (startswith (name, "__gcov")) return x; } }=