Re: [PATCH] c++: ICE with -fsanitize=vptr and constexpr dynamic_cast [PR98103]

2020-12-08 Thread Jason Merrill via Gcc-patches
On 12/4/20 10:40 PM, Marek Polacek wrote: On Wed, Dec 02, 2020 at 09:01:48PM -0500, Jason Merrill wrote: On 12/2/20 6:18 PM, Marek Polacek wrote: -fsanitize=vptr initializes all vtable pointers to null so that it can catch invalid calls; see cp_ubsan_maybe_initialize_vtbl_ptrs. That means that

Re: [PATCH] c++: ICE with -fsanitize=vptr and constexpr dynamic_cast [PR98103]

2020-12-04 Thread Marek Polacek via Gcc-patches
On Wed, Dec 02, 2020 at 09:01:48PM -0500, Jason Merrill wrote: > On 12/2/20 6:18 PM, Marek Polacek wrote: > > -fsanitize=vptr initializes all vtable pointers to null so that it can > > catch invalid calls; see cp_ubsan_maybe_initialize_vtbl_ptrs. That > > means that evaluating a vtable reference c

Re: [PATCH] c++: ICE with -fsanitize=vptr and constexpr dynamic_cast [PR98103]

2020-12-02 Thread Jason Merrill via Gcc-patches
On 12/2/20 6:18 PM, Marek Polacek wrote: -fsanitize=vptr initializes all vtable pointers to null so that it can catch invalid calls; see cp_ubsan_maybe_initialize_vtbl_ptrs. That means that evaluating a vtable reference can produce a null pointer in this mode, so cxx_eval_dynamic_cast_fn should

[PATCH] c++: ICE with -fsanitize=vptr and constexpr dynamic_cast [PR98103]

2020-12-02 Thread Marek Polacek via Gcc-patches
-fsanitize=vptr initializes all vtable pointers to null so that it can catch invalid calls; see cp_ubsan_maybe_initialize_vtbl_ptrs. That means that evaluating a vtable reference can produce a null pointer in this mode, so cxx_eval_dynamic_cast_fn should check that. Bootstrapped/regtested on x86_