From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C6CA3858D28; Sun, 21 Apr 2024 17:20:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C6CA3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713720045; bh=BmIxP94IR6AkneBcshQumPl8btHJsd27s3l8a/OQq0A=; h=From:To:Subject:Date:From; b=WkHSYgPoo93aqMJmw1Cj9+TKd6YCNTuc2N5S2aZRLRXSsMIm6MWyrwccEPopCwH/7 x+tD/IAu/tI2k29rjJ6PNsf8oNbb3R+R8jwJKM8seKME0VxJOfm2km30JeA1LVq+RW BJ6pXLpMhuPl9wg9z+BLt2loyF1l1Sr+fvoPJEEA= From: "xxs_chy at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114797] New: Missed optimization : fail to merge memset with unrelated clobber Date: Sun, 21 Apr 2024 17:20:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xxs_chy at outlook dot com 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 target_milestone 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=3D114797 Bug ID: 114797 Summary: Missed optimization : fail to merge memset with unrelated clobber Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: xxs_chy at outlook dot com Target Milestone: --- Godbolt link: https://godbolt.org/z/E581jvaPs Code like: ``` void src(char* config){ char stack[208]; memset(stack, 0, 184); *config =3D 0; memset(stack + 184, 0, 8); use(stack); } ``` can be transformed to ``` void tgt(char* config){ char stack[208]; memset(stack, 0, 192); *config =3D 0; use(stack); } ``` GCC doesn't merge them even both memsets overlap: https://godbolt.org/z/ffc6b8zqs=