[Bug tree-optimization/92689] Improve stmt_may_clobber_ref_p_1 on constant memory reference

2020-01-30 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|

[Bug tree-optimization/92689] Improve stmt_may_clobber_ref_p_1 on constant memory reference

2019-11-27 Thread fxue at os dot amperecomputing.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689 --- Comment #6 from Feng Xue --- Good case. I did missed something, a const pointer does not imply it is restrict and for a real const data, we can even create a non-const pointer alias to it by using explicit type cast.

[Bug tree-optimization/92689] Improve stmt_may_clobber_ref_p_1 on constant memory reference

2019-11-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689 --- Comment #5 from Richard Biener --- Also see PR92419 which was motivated by improving handling of TREE_READONLY declarations. And indeed we cannot rely on const qualification of pointers in any way.

[Bug tree-optimization/92689] Improve stmt_may_clobber_ref_p_1 on constant memory reference

2019-11-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689 --- Comment #4 from Andrew Pinski --- Actually the testcase which causes the return true to be correct would be: extern int data; void (void) { foo (); } void fn(void) { data++; } CUT --- I think you need either a better testcase

[Bug tree-optimization/92689] Improve stmt_may_clobber_ref_p_1 on constant memory reference

2019-11-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689 --- Comment #3 from Andrew Pinski --- The argument p could have been a non const when it was passed to foo. That is outside of the this TU: static int t; void (void) { foo (); } void fn(void) { t++; }

[Bug tree-optimization/92689] Improve stmt_may_clobber_ref_p_1 on constant memory reference

2019-11-27 Thread fxue at os dot amperecomputing.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689 --- Comment #2 from Feng Xue --- int fn(); int goo(const int *p) { return fn(); } int data; int foo (const int *p) { int i; int t; data = *p; for (i = 0; i < 100; i++) { int t = *p + 1; goo

[Bug tree-optimization/92689] Improve stmt_may_clobber_ref_p_1 on constant memory reference

2019-11-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689 Andrew Pinski changed: What|Removed |Added Severity|normal |enhancement --- Comment #1 from Andrew