This is the mail archive of the gcc-bugs@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]

[Bug sanitizer/67515] crash from ubsan for non-virtual call in initializer list with an invalid vtable


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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
You can get the same segfault with clang++ e.g. on
struct A
{
  int a;
  A () {}
  int foo () { return 1; }
  virtual ~A () {}
};
alignas (A) char buf[sizeof (A)];

void foo (void *x)
{
  A *y = (A *) x;
  y->foo ();
}

int main ()
{
  __builtin_memset (buf, '\x7f', sizeof 0);
  foo (&buf);
}
(but as in this case it is really called on object not even started to be
constructed, there is no other workaround than to slow down the library).


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