martong added a comment.

About the whole raw offset and the related warning. There is a fundamental 
question: Should we warn at `&a[0][10]` ?

  void foo() {
    int a[10][10];
    int *p0 = &a[9][9];   // OK
    int *p1 = &a[10][10]; // Out-of-bounds
    static_assert(&a[0][10] == &a[1][0]);
    int *p2 = &a[0][10];  // Syntactically (or technically) out-of-bounds, We 
should warn here !(?)
    int *p3 = &a[1][0];   // Neither syntactically nor semantically 
out-of-bounds, but it aliases with p2 and p2 is flawed
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86874

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

Reply via email to