[llvm-commits] [PATCH] [msan] Change va_start/va_copy shadow memcpy alignment to 8

Peter Collingbourne peter at pcc.me.uk
Thu Jan 10 02:11:48 PST 2013



Evgeniy Stepanov <eugenis at google.com> wrote:

>
>According to AMD64 psABI document, va_list is defined as a 1-element
>array of 24-byte-sized aggregates. Then, in 3.1.2:
>
>An array uses the same alignment as its elements, except that a local
>or global array variable that requires at least 16 bytes, or a C99
>local or global variable length array variable, always has alignment of
>at least 16 bytes.

My interpretation of that paragraph is that the 16 byte rule applies only to top level array variables, not to fields of a structure.

>Sounds like va_list must be 16-bytes aligned. Or do I misunderstand the
>standard somewhere? Could you provide an example?

E.g.

struct foo {
  void *p;
  va_list l;
};

In this case l would be laid out at offset 8.

Thanks,
Peter





More information about the llvm-commits mailing list