aaron.ballman added a comment.

One thing I think is worth asking in this thread is whether what you're 
analyzing is undefined behavior?

Array subscripting is defined in terms of pointer addition per: 
http://eel.is/c++draft/expr.sub#1
Pointer addition has a special behavior for arrays: 
http://eel.is/c++draft/expr.add#4 ("Otherwise, if P points to an array element 
i of an array object x with n elements ... Otherwise, the behavior is 
undefined.")

I am pretty sure that at least in C++, treating a multidimensional array as a 
single dimensional array is UB because of the strength of the type system 
around arrays. And when you turn some of these examples into constant 
expressions, we reject them based on the bounds. e.g., 
https://godbolt.org/z/nYPcY14a8


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

https://reviews.llvm.org/D104285

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

Reply via email to