From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 16C71385AC25; Wed, 1 Sep 2021 18:52:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16C71385AC25 From: "danglin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102162] Byte-wise access optimized away at -O1 and above Date: Wed, 01 Sep 2021 18:52:46 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: danglin 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: attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2021 18:52:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102162 --- Comment #1 from John David Anglin --- Created attachment 51395 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51395&action=3Dedit Second test case Changing the optimization of get_unaligned_le32 to 0 results in correct code generation. We have the following in test-unaligned.c.235t.optimized: ave@atlas:~/linux/misc$ cat test-unaligned.c.235t.optimized ;; Function get_unaligned_le32 (get_unaligned_le32, funcdef_no=3D0, decl_uid=3D1506, cgraph_uid=3D1, symbol_order=3D1) __attribute__((optimize (0))) get_unaligned_le32 (const void * p) { const struct { u32 x; } * __pptr; u32 D.1517; u32 _4; : __pptr_2 =3D p_1(D); _4 =3D __pptr_2->x; : : return _4; } ;; Function test (test, funcdef_no=3D1, decl_uid=3D1512, cgraph_uid=3D2, symbol_order=3D2) test () { unsigned int _1; int _4; [local count: 1073741824]: _1 =3D get_unaligned_le32 (&output_len); [tail call] _4 =3D (int) _1; return _4; }=