[all-commits] [llvm/llvm-project] 8392f1: Fix __builtin_assume_aligned incorrect type descri...

黄金橘子猫 via All-commits all-commits at lists.llvm.org
Tue Sep 20 09:36:03 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8392f1cc78270c7039970b413dfd836bf4def602
      https://github.com/llvm/llvm-project/commit/8392f1cc78270c7039970b413dfd836bf4def602
  Author: yronglin <yronglin777 at gmail.com>
  Date:   2022-09-20 (Tue, 20 Sep 2022)

  Changed paths:
    M clang/include/clang/Basic/Builtins.def
    M clang/lib/Basic/Builtins.cpp
    M clang/lib/Sema/SemaChecking.cpp
    A clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-polymorphism.cpp
    M clang/test/Sema/builtin-redecl.cpp

  Log Message:
  -----------
  Fix __builtin_assume_aligned incorrect type descriptor and C++ object polymorphic address

Fix __builtin_assume_aligned incorrect type descriptor

example from @rsmith

struct A { int n; };
struct B { int n; };
struct C : A, B {};

void *f(C *c) {
  // Incorrectly returns `c` rather than the address of the B base class.
  return __builtin_assume_aligned((B*)c, 8);
}

Differential Revision: https://reviews.llvm.org/D133583




More information about the All-commits mailing list