This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/67515] crash from ubsan for non-virtual call in initializer list with an invalid vtable
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Sep 2015 13:32:52 +0000
- Subject: [Bug sanitizer/67515] crash from ubsan for non-virtual call in initializer list with an invalid vtable
- Auto-submitted: auto-generated
- References: <bug-67515-4 at http dot gcc dot gnu dot org/bugzilla/>
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).