This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: sparc 32-bit dirent broken


On Thu, 10 Oct 2013, David Miller wrote:

> Any suggestions for a better alignof or is this good enough to fix
> the problem?  We probably should have a per-sysdep definition of
> "largest C type alignment" so we can use it in situations like this.

In principle, C11's max_align_t in <stddef.h> is what you want.  But:

(a) The first GCC version with it is 4.7 and we support older versions to 
build glibc.

(b) The C11 specifications regarding alignment have several deficiencies.  
See <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1731.pdf> for a 
discussion.

(c) The alignment of max_align_t, although a reasonable empirical 
approximation to the alignment required by C99 / C11, may in fact not be 
supported by malloc (powerpc32 - bug 6527).

(d) If new types such as decimal floating point (defined as extensions to 
ISO C in a way that means their alignment should be supported in all 
contexts) get supported, this may change the alignment of max_align_t (so 
it's not a great idea to use it in ABIs in a way that would affect) and 
may also increase the requirements on malloc alignment (see my comment in 
bug 6527 about how really the alignment should be increased for 32-bit x86 
as well).

-- 
Joseph S. Myers
joseph@codesourcery.com


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