[all-commits] [llvm/llvm-project] 9c89b2: -fsanitize=function: fix MSVC hashing to sugared t...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Mon Oct 2 10:09:52 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c89b29555a7ccfc3942340f558c3bbea8d10532
      https://github.com/llvm/llvm-project/commit/9c89b29555a7ccfc3942340f558c3bbea8d10532
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    M clang/include/clang/AST/Mangle.h
    M clang/lib/AST/Expr.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/CodeGen/CGBlocks.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CGVTables.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenTBAA.cpp
    M clang/test/CodeGen/ubsan-function-sugared.cpp
    M clang/unittests/AST/DeclTest.cpp

  Log Message:
  -----------
  -fsanitize=function: fix MSVC hashing to sugared type (#66816)

Hashing the sugared type instead of the canonical type meant that
a simple example like this would always fail under MSVC:

```
static auto l() {}
int main() {
  auto a = l;
  a();
}
```
`clang --target=x86_64-pc-windows-msvc -fno-exceptions
-fsanitize=function -g -O0 -fuse-ld=lld -o test.exe test.cc`

produces:
```
test.cc:4:3: runtime error: call to function l through pointer to incorrect function type 'void (*)()'
```




More information about the All-commits mailing list