[PATCH] D104285: [analyzer][AST] Retrieve value by direct index from list initialization of constant array declaration.
Denys Petrov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 17 09:10:05 PDT 2021
ASDenysPetrov added a comment.
@aaron.ballman
Let me speak some thoughts. Consider next:
int arr[2][5];
int *ptr1 = &arr[0][0];
int *ptr2 = &arr[1][0];
The Standard tells that `ptr1[5]` is UB and `ptr2[0]` is a valid object. In practice `ptr1` and `ptr2` usually are equal. But the Standard does not garantee them to be equal and this depends on a particular implementation. So we should rely on that there might be a compiler such that creates every subarray disjointed. I think this is an exact excerpt from what our arguing actually starts from.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104285/new/
https://reviews.llvm.org/D104285
More information about the cfe-commits
mailing list