From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5CABB3857695; Tue, 1 Nov 2022 20:23:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CABB3857695 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667334204; bh=Wm9o8ZTcaGAwBnKD0FuwpSMY2htqG2nDWLaFTRd5c/k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wYY5Jtn1EU/o7uKLe++8yZG5Sm6vbq1Ulm1/ICuaLjG5YvddgiDROics4HY1dzCg6 e9CJYaIy+nL9qAdzKZg//galsOXY/w0cLmmopeXSigHF4iBtRxvVkTHU1PYYhIY0Nn Jtgb6to3DVfrOBXEiXGwmc/ygwlKPpmI76at0vJs= From: "ebotcazou at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107498] Wrong optimization leads to unaligned access when compiling OpenLDAP Date: Tue, 01 Nov 2022 20:23:23 +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: 12.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ebotcazou at gcc dot gnu.org X-Bugzilla-Status: WAITING 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: cf_reconfirmed_on bug_status everconfirmed 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=3D107498 Eric Botcazou changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-11-01 Status|UNCONFIRMED |WAITING Ever confirmed|0 |1 --- Comment #5 from Eric Botcazou --- Note that the fields are marked volatile in the source: union { struct { volatile indx_t pb_lower; volatile indx_t pb_upper; } pb; uint32_t pb_pages; } mp_pb; But, yes, it looks like something went wrong earlier: mp is a pointer to MDB_page, which is a structure containing a union containing a uint32_t fie= ld, which gives it an alignment of 4 bytes, so mp must be a multiple of 4. mp_= pb is a union containing a uint32_t field so it is at an offset multiple of 4.= So &mp->mp_pb.pb must be a multiple of 4 and, assuming that it is contained in %l0, the instruction: 0x00000100000c8aec <+300>: st %l3, [ %l0 + 0xc ] would therefore be legal. Can anyone print the value of mp in the debugger?=