From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF6F83858C20; Tue, 16 Aug 2022 08:34:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF6F83858C20 From: "xgchenshy at 126 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106635] AARCH64 STUR instruction causes bus error Date: Tue, 16 Aug 2022 08:34:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: xgchenshy at 126 dot com 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: 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: Tue, 16 Aug 2022 08:34:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106635 --- Comment #2 from Xiaoguang --- (In reply to Richard Biener from comment #1) > Can you provide preprocessed source of the whole translation unit so the > testcase is compilable? Sure, please see below complete code. void CWLCollectReadRegData(u32* dst,u16 reg_start, u32 reg_length,u32* total_length, addr_t status_data_base_addr) { u32 data_length=3D0; { //opcode *dst++ =3D (OPCODE_RREG<<27)|(reg_length<<16)|(reg_start*4); data_length++; //data volatile u32 temp_32 =3D (u32)status_data_base_addr; // fix compiler optimization -O2 bug: stur x4, [x0, #4] *dst++ =3D temp_32; data_length++; if(sizeof(addr_t) =3D=3D 8) { *dst++ =3D (u32)(((u64)status_data_base_addr)>>32); data_length++; } else { *dst++ =3D 0; data_length++; } //alignment *dst =3D 0; data_length++; *total_length =3D data_length; } }=