[PATCH] D157252: [clang][ExprConst] Handle 0 type size in builtin_memcpy etc.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 20 08:42:19 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/test/Sema/builtin-memcpy.c:4-8
+int b() {
+ struct { } a[10];
+ __builtin_memcpy(&a[2], a, 2); // expected-warning {{buffer has size 0, but size argument is 2}}
+ return 0;
+}
----------------
The only other test I'd like to see is one like:
```
constexpr int b() {
struct { } a[10];
__builtin_memcpy(&a[2], a, 2); // UB here should be caught, right?
return 0;
}
static_assert(b() == 0, "");
```
(if that's follow-up work, that's fine too, just leave a test with a FIXME comment.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157252/new/
https://reviews.llvm.org/D157252
More information about the cfe-commits
mailing list