From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5E9EB3858C50; Thu, 4 Apr 2024 10:59:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E9EB3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712228397; bh=AANQNC49J/8kx5u6HAFRT4rvoa8fFn+n3MoC1ul0oLk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xrMRUPJ3Xecl0nJjMGdbDky+XGGMTaESjR7Lg6V1KNS6YmAHR141FYqJ+XhLPVZ08 mc5/D1jpQKBtXew6veB18JxkPf8gx81groY9UxVutPLRWr0y/hPN6Wr2eUU4etMmla NMhTjBho3s5UZfGmXc1p9jl3X59a8PulpUn3FK8A= From: "wilco at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110773] [Aarch64] crash (SIGBUS) due to atomic instructions on under-aligned memory Date: Thu, 04 Apr 2024 10:59:56 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: wilco 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: 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=3D110773 --- Comment #4 from Wilco --- (In reply to Sainan from comment #3) > I seem to be having a related issue, although in my case the struct looks > like this: >=20 > template > struct Data > { > T* data; > std::atomic_uint count; > bool flag; > }; >=20 > And it's crashing on `--count;` >=20 > Surely this is not a user issue in this case because the pointer should > always be 8 bytes, so count should be evenly aligned on a 8-byte boundary. > (Unless the atomic operation needs 16-byte alignment?) The atomic will also set correct struct alignment. > Same code also runs fine when compiled via MSVC and run on Windows, altho= ugh > it's unclear if this might simply be my Linux test machine running an old= er > ARM CPU compared to my Windows on ARM test machine. You would get a crash if you build for LSE so you get a LDADDAL instruction= and then run it on a CPU that doesn't. So try -mcpu=3Dnative and it should work= .=