From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F2C19384B438; Thu, 13 Aug 2020 03:13:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2C19384B438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597288385; bh=88hLkPg1ECY7NCo/GWmdB4T7TUEb6ccY3snJ7XEX9WY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oM/FJibsDb+Tuv+xBMuDVrjOiGinLqma4aEP35v4UgLUdYUAj+Fe5zR2U2t61QG4/ mSPJV5pcpNpA0Gtd6ezjB7RqfyJtfCcOJfEuaIImuol48Y6HEXWDJB2J49WTdrRBMZ T+Il8Gb/iZqNOXw/gs0Z8+pSEd7DrUq+3E+32mNE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/94600] Ignored volatile specifier on loop unrolling and bitfield misoptimization Date: Thu, 13 Aug 2020 03:13:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit 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 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: Thu, 13 Aug 2020 03:13:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94600 --- Comment #11 from CVS Commits --- The master branch has been updated by Hans-Peter Nilsson : https://gcc.gnu.org/g:5db1fa9bc69dd58ce2f93dd707d05efcfe89ffa8 commit r11-2682-g5db1fa9bc69dd58ce2f93dd707d05efcfe89ffa8 Author: Hans-Peter Nilsson Date: Thu Aug 13 05:12:23 2020 +0200 gcc.dg/pr94600-5.c .. -8.c: Align struct t0 explictly, as a type, PR middle-end/94600 The bitfield-struct t0 in gcc.dg/pr94600-1.c ..-4.c is assigned to a pointer that is a (volatile-and-pointer-)cast literal, so gcc doesn't need to be otherwise told that the address is aligned. But, variants pr94600-5.c ..-8.c are assigned through a "volatile t0 *", and rely on the *type* being naturally aligned, or that the machine has non-strict-alignment moves. Unfortunately, systems exist (for some definitions of exist) where such structs aren't always naturally aligned, for example if it contains only (small) bitfields, even though the size is a naturally accessible size. Specifically, the mmix-knuth-mmixware port has only *byte* alignment for this struct. (If an int is added to the struct, alignment is promoted.) IOW, a prerequisite of the test is false: the struct doesn't have the same alignment as an integer of the same size. The effect is assignment in byte-size pieces, and the test fails. (For a non-volatile assignment, memcpy is called.) That's easily fixable by defining the type as having a specific alignment. This is also closer to the type in the original code, and also as the first variants aren't affected, no second thought or re-visit of pre-fixed compiler is needed. I don't plan to back-port this to gcc-10 branch however. I did sanity-check that the tests still pass on ppc64le-linux. gcc/testsuite: PR middle-end/94600 * gcc.dg/pr94600-5.c, gcc.dg/pr94600-6.c, gcc.dg/pr94600-7.c, gcc.dg/pr94600-8.c: Align t0 to 4-byte boundary.=