[all-commits] [llvm/llvm-project] c4c23f: [clang] Fix crash in dynamic_cast final class opti...

Oliver Hunt via All-commits all-commits at lists.llvm.org
Wed Aug 6 01:14:02 PDT 2025


  Branch: refs/heads/users/ojhunt/pr-137518
  Home:   https://github.com/llvm/llvm-project
  Commit: c4c23ff5ee6f6ec165cd2511c061a270d7ff3af7
      https://github.com/llvm/llvm-project/commit/c4c23ff5ee6f6ec165cd2511c061a270d7ff3af7
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-08-06 (Wed, 06 Aug 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/CodeGen/CGCXXABI.h
    M clang/lib/CodeGen/CGExprCXX.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/CodeGen/MicrosoftCXXABI.cpp
    M clang/test/CodeGenCXX/dynamic-cast-exact-disabled.cpp
    M clang/test/CodeGenCXX/dynamic-cast-exact.cpp

  Log Message:
  -----------
  [clang] Fix crash in dynamic_cast final class optimization

This corrects the codegen for the final class optimization to
correct handle the case where there is no path to perform the
cast, and also corrects the codegen to handle ptrauth protected
vtable pointers.

As part of this fix we separate out the path computation as
that makes it easier to reason about the failure code paths
and more importantly means we can know what the type of the
this object is during the cast.

The allows us to use the GetVTablePointer interface which
correctly performs the authentication operations required when
pointer authentication is enabled. This still leaves incorrect
authentication behavior in the multiple inheritance case but
currently the optimization is disabled entirely if pointer
authentication is enabled.

Fixes #137518



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list