https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102586

--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
With the C7/C8 case, it is actually not just about clearing too much, but
clearing different bits:
struct C0 {};
struct C1 {};
struct C2 : C1, virtual C0 {};
struct C3 : virtual C2, C1 {};
struct C6 { char c; };
struct C7 : virtual C6, virtual C3, C1 {};
struct C8 : C7 {};

__attribute__((noipa)) void
foo (C8 *q)
{
  __builtin_clear_padding (q);
}

__attribute__((noipa)) void
bar (C7 *q)
{
  __builtin_clear_padding (q);
}

void
baz ()
{
  C8 c8;
  foo (&c8);
  bar (&c8);
}
will clear in one case the padding byte at offset 8, in the other case will
keep that unchanged and will clear the byte after it.

Reply via email to