On 09/06/2016 11:11 AM, Florian Weimer wrote:

I think this change is only safe because nothing relies on it.
max_align_t is a committee invention with no actual users.

I tried to verify that and ran grep over all the packages in /usr/portage/distfiles. That did get a number of matches, fairly obvious and expected ones like gcc and glibc, and several more which match only because gnulib seems to try to provide a default, but I also found a few real uses:

grep-2.25/lib/fts.c:
        /* Align the allocation size so that it works for FTSENT,
           so that trailing padding may be referenced by direct access
to the flexible array members, without triggering undefined behavior by accessing bytes beyond the heap allocation. This implicit access
           was seen for example with ISDOT() and GCC 5.1.1 at -O2.
           Do not use alignof (FTSENT) here, since C11 prohibits
           taking the alignment of a structure containing a flexible
           array member.  */
        len += alignof (max_align_t) - 1;
        len &= ~ (alignof (max_align_t) - 1);


libvpx-v1.3.0/nestegg/halloc/src/halloc.c:
/*
 *      block control header
 */
typedef struct hblock
{
#ifndef NDEBUG
#define HH_MAGIC    0x20040518L
        long          magic;
#endif
        hlist_item_t  siblings; /* 2 pointers */
        hlist_head_t  children; /* 1 pointer  */
        max_align_t   data[1];  /* not allocated, see below */

} hblock_t;


Bernd

Reply via email to