This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Implement new hook for max_align_t_align


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]