tbaeder 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; +} ---------------- aaron.ballman wrote: > 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.) Nope, clang accepts that and GCC rejects the function when calling. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157252/new/ https://reviews.llvm.org/D157252 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits