On Mon, Jul 14 2025, Jonathan Wakely via Gcc wrote:
> On Mon, 14 Jul 2025 at 14:57, Thomas de Bock via Gcc <gcc@gcc.gnu.org> wrote:
>>
>> Hello all, I've been looking into a compiler optimization implemented by 
>> clang but not gcc that substitutes a __dynamic_cast call for a simple vtable 
>> ptr comparison in the case that the class being cast to is final.
>>
>> However this brings issues with it in some cases (specified in thread). I 
>> believe having the optimization disabled by default, but adding a compiler 
>> flag to enable it would be ideal. Code for the optimization is mostly done 
>> so I'm looking to have this optimization available in gcc somehow now, 
>> interested in hearing any opinions on this :)
>>
>> thread link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63164#add_comment
>
> I agree that we don't want to perform the optimization by default, but
> it would be useful to have an option to enable it when you know it's
> safe to do so.

If it materializes in this form, could we include it in -Ofast?

Thanks,

Martin

Reply via email to