This is the mail archive of the gcc@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: Options of fixing biggest alignment in PR target/38736


"H.J. Lu" <hjl.tools@gmail.com> writes:

> It it hard to guess what the alignment should be for C++ new operator.
> Whatever you choose today may not be appropriate tomorrow
> or for others. I think g++ should issue a warning when new operator
> is used on a type whose alignment greater than MALLOC_ABI_ALIGNMENT:

The real problem is not a single value, but an array of some type.
Auto-vectorization optimizations may apply, and they may require a
larger alignment, and the compiler may believe that the memory
allocator provides a larger alignment than it actually does.  The
compiler can not know the minimal alignment returned by the memory
allocator, because the user can change the memory allocator.

We need to write __attribute__ ((aligned (XXX))) accordingly.

I see that MALLOC_ABI_ALIGNMENT exists, but the value is overly
conservative by default, and no target defines it, and the only thing
which actually uses is the Ada frontend.

Ian


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