void added inline comments.
================
Comment at: clang/test/Sema/array-bounds-ptr-arith.c:14
+void* broken (struct ext2_super_block *es,int a) {
+  return (void *)es->s_uuid + 9; // expected-warning {{the pointer incremented 
by 9 refers past the end of the array (that contains 8 elements)}}
 }
----------------
nickdesaulniers wrote:
> void wrote:
> > serge-sans-paille wrote:
> > > I'm fine with that change, but I don't understand how it relates to that 
> > > commit ;-)
> > The original size 80 was large enough to emit a warning. However, 9 
> > *didn't* emit a warning, but should. (Note that 8 won't emit a warning 
> > because of pointer arithmetic voodoo.)
> It's slightly confusing, but the previous increment of 80 masked the issue 
> with a smaller increment that was still out of bounds, IIUC.  I think the 
> previous code had a bytes vs bits bug?
Yes, that's pretty much what way happening. The comparison would be 80 (index) 
vs 64 (array length). But when the `ptrarith_typesize` is one, the comparison 
is 9 vs 64.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135989/new/

https://reviews.llvm.org/D135989

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to