https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110773

--- Comment #4 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Sainan from comment #3)
> I seem to be having a related issue, although in my case the struct looks
> like this:
> 
> template <typename T>
> struct Data
> {
>     T* data;
>     std::atomic_uint count;
>     bool flag;
> };
> 
> And it's crashing on `--count;`
> 
> 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, although
> it's unclear if this might simply be my Linux test machine running an older
> 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=native and it should work.

Reply via email to