From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D6F03861887; Fri, 20 Oct 2023 22:25:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D6F03861887 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697840746; bh=bf2U3OUMDhk/P5OLRkLvWD2gSYIYke27DfwK7wFgcJ8=; h=From:To:Subject:Date:From; b=nLW5te9h3bZZ8xc+FbUhJ7qwf8hB7FGO9n88fE7Ty8K5GlBSqLnDcc+qG8YCsc3Ur VNOfqI4npiFUGhcYql19uif3nVuumiyUmXd2ANmqFA46zkzoY9JBvtF0Pm8sMWqu+2 KNLRE13cqEqhM/2fOG2r3ME4RUfP6BExVfcCUakA= From: "sjames at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111904] New: Miscompilation with -O3 -fharden-control-flow-redundancy? Date: Fri, 20 Oct 2023 22:25:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sjames at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: 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=3D111904 Bug ID: 111904 Summary: Miscompilation with -O3 -fharden-control-flow-redundancy? Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org CC: aoliva at gcc dot gnu.org Target Milestone: --- Created attachment 56161 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56161&action=3Dedit memset_explicit-gone-wrong.tar.xz Needs a trunk build from today or newer for -fharden-control-flow-redundanc= y. 1. git clone https://git.savannah.gnu.org/git/gnulib.git 2. ./gnulib-tool --single-configure --conditional-dependencies --create-tes= tdir --dir=3Duhoh memset_explicit 3. cd uhoh 4. ./configure CFLAGS=3D"-O3 -fharden-control-flow-redundancy" # passes wit= h -O2 5. make TESTS=3Dtest-memset_explicit check -j$(nproc) ``` $ ./test-memset_explicit test_heap: address range is still mapped after free(). test_stack: count =3D 1000 test-memset_explicit.c:191: assertion 'count < 50' failed Aborted (core dumped) ``` I'm not sure where it goes wrong yet. Attached memset_explicit-gone-wrong.tar.xz has uhoh-O2 (good) and uhoh-O3 (bad) for x86_64, but I reproduced this on arm64 too.=