aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land.
LGTM with a fixme comment added. ================ 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; +} ---------------- tbaeder wrote: > 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. Amusingly, Clang and EDG (GNU mode) accept and GCC rejects. GCC is correct, so it's worth adding a FIXME to the case below so we know this isn't intentional behavior. 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