This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [libstdc++/65033] Give alignment info to libatomic
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: Richard Henderson <rth at redhat dot com>, libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, Andrew MacLeod <amacleod at redhat dot com>
- Date: Thu, 2 Apr 2015 23:04:20 -0400 (EDT)
- Subject: Re: [libstdc++/65033] Give alignment info to libatomic
- Authentication-results: sourceware.org; auth=none
- References: <54DD19B7 dot 6060401 at redhat dot com> <20150218121512 dot GI3360 at redhat dot com> <20150325162244 dot GF9755 at redhat dot com>
On Wed, 25 Mar 2015, Jonathan Wakely wrote:
> I've convinced myself that Richard's patch is correct in all cases,
> but I think we also want this patch, to fix PR62259 and PR65147.
>
> For the generic std::atomic<T> (i.e. not the integral or pointer
> specializations) we should increase the alignment of atomic types that
> have the same size as one of the standard integral types. This should
> be consistent with what the C front end does for _Atomic, based on
> what Joseph told me on IRC:
Wrong.
> <jsm28> jwakely: _Atomic aligns 1/2/4/8/16-byte types the same as
> integer types of that size.
No it doesn't! It's "same or higher as".
> <jsm28> (Which may not be alignment = size, depending on the
> architecture.)
>
> Ideally we'd use an attribute like Andrew describes at
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62259#c4 but that's not
> going to happen for GCC 5, so this just looks for an integral type of
> the same size and uses its alignment.
>
> Tested x86_64-linux, powerpc64le-linux.
>
> I'll wait for RM approval for this and Richard's patch (which is OK
> from a libstdc++ perspective).
>
brgds, H-P