From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A4B338582BE; Fri, 27 Jan 2023 12:51:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A4B338582BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674823870; bh=zYFQRfjywFHhR6mMbLtiOZV1vbN/ij+9hEDCYXAprl0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eW7WKJLbLKsLbHgFgyrcs37POXDtsgyNQNVBK8c2uN8bhaAuaIfa4BrV/U1jQ++xV eoALEJEsQ5oANFMPB8rUyMPRjP48TFacygxjh5QJNlSITSCaYhwLh/ocQ2RHNKqm2i HeNxIKKXsspxy7f0h+2TOOwYC7Lcgj5knYZQi9Wc= From: "ubizjak at gmail dot com" 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: Fri, 27 Jan 2023 12:51:10 +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: ubizjak at gmail dot com 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 #19 from Uro=C5=A1 Bizjak --- Some further analysis: pretmp_94 =3D __gcov0.prep_compound_page[7]; <-- _179 =3D pretmp_94 + 1; <-- ivtmp.1725_211 =3D (unsigned long long) _179; _135 =3D (unsigned int) nr_pages_11; _134 =3D _135 + 4294967294; <-- _132 =3D (unsigned long long) _134; <-- _89 =3D (unsigned long long) pretmp_94; <-- _76 =3D _89 + 2; <- _19 =3D _76 + _132; <- And the loop exit condition is: # ivtmp.1725_77 =3D PHI ... ivtmp.1725_69 =3D ivtmp.1725_77 + 1; And the loop exit condition is: if (_19 !=3D ivtmp.1725_69) So, both ivtmp and _19 are calculated from the value at __gcov0.prep_compound_page. But as shown in Comment #15, we have two separa= te reads from the location, the compiler assumes that the value there is invariant, which is probably not the case.=