ASDenysPetrov added a comment.

@steakhal Please, read the discussion started from here D104285#2943449 
<https://reviews.llvm.org/D104285#2943449>. It's directly relates to this patch 
and what we've been arguing about.

I'm still hesitating about this patch.
On one hand we have the fact that almost all compilers ignore some Standard's 
paragraphs about UB in terms of casts.
E.g. they consider next snippets as OK, but they are NOT according to the 
Standard <http://eel.is/c++draft/basic.lval#11>:

- `int arr[1][2][3]; int *ptr = (int*)arr; ptr[4] = 42;` // **int(*)[2][3]** 
can't be aliased by **int***
- `int i; signed char *ptr = (signed char*)&i; ptr[2] = 42;` // **int*** can't 
be aliased by **signed char***
- `int arr[3][3]; int (*ptr)[8] = (int(*)[6])arr; ptr[1][1] = 42;` // `ptr[1]` 
can't go further then aliased by **int(*)[6]**

I've checked all those examples on Godbolt
On the other hand introducing this patch will show unexpected warnings to users 
which they can't reproduce in a real life.

I can't choose the way to act.


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

https://reviews.llvm.org/D110927

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

Reply via email to