[all-commits] [llvm/llvm-project] 6ca2f1: [Clang][Sema] Avoid crashing for `__builtin_memcpy...

Egor Zhdan via All-commits all-commits at lists.llvm.org
Mon Mar 14 05:47:45 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6ca2f1938f96a71abdecdd96508f48e4d20a5694
      https://github.com/llvm/llvm-project/commit/6ca2f1938f96a71abdecdd96508f48e4d20a5694
  Author: Egor Zhdan <e_zhdan at apple.com>
  Date:   2022-03-14 (Mon, 14 Mar 2022)

  Changed paths:
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/Sema/builtins-memcpy-inline.cpp

  Log Message:
  -----------
  [Clang][Sema] Avoid crashing for `__builtin_memcpy_inline` with an array argument

This change teaches the Sema logic for `__builtin_memcpy_inline` to implicitly convert arrays passed as arguments to pointers, similarly to regular `memcpy`.

This code will no longer cause a compiler crash:
```
void f(char *p) {
    char s[1] = {0};
    __builtin_memcpy_inline(p, s, 1);
}
```

rdar://88147527

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




More information about the All-commits mailing list