This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Implement new hook for max_align_t_align
- From: Jason Merrill <jason at redhat dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: John David Anglin <dave dot anglin at bell dot net>, Bernd Edlinger <bernd dot edlinger at hotmail dot de>, gcc-patches List <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>
- Date: Tue, 11 Oct 2016 16:11:41 -0400
- Subject: Re: [PATCH] Implement new hook for max_align_t_align
- Authentication-results: sourceware.org; auth=none
- References: <CADzB+2=XBG7d2Lp8UraKKYVjZzsEvxXM4tgVPN6ORn5ib=ztLQ@mail.gmail.com> <xneg3mvhir.fsf@greed.delorie.com>
On Tue, Oct 11, 2016 at 2:59 PM, DJ Delorie <dj@redhat.com> wrote:
>
> Jason Merrill <jason@redhat.com> writes:
>> If PA malloc doesn't actually provide 16-byte alignment, this change
>> seems problematic; it will mean any type that wants 16-byte alignment
>> will silently get 8-byte alignment instead.
>
> Should such cases be calling memalign (or posix_memalign) instead of
> malloc?
We're talking about this in the context of C++17 aligned new, which
uses one of those functions (or C aligned_alloc) under the hood.
Currently on PA, allocating one of these types with 'new' in C++14
mode gives a warning because the compiler doesn't think the allocation
will actually provide the 16-byte alignment that the type wants. This
warning seems to be correct. This patch would silence that warning by
pretending that malloc will provide 16-byte alignment, which is not
actually true.
It seems to me that the warning is correct, but not a problem in this
case, so perhaps turning the warning off by default on PA is the right
solution.
Jason