[Bug tree-optimization/81009] missing aliasing optimization for const restrict pointers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81009 Richard Biener changed: What|Removed |Added CC||rguenth at gcc dot gnu.org --- Comment #1 from Richard Biener --- const qualification doesn't mean anything to the middle-end and it would be dangerous to interpret it that way given we support more than just C as input language. So the C FE would have to communicate this in a more explict way. Anyway, doesn't this even apply to void f (int *); void g (const int* restrict p) { int x = *p; f ((int *)p); // f() cannot modify *p here if (x != *p) // cannot be true __builtin_abort (); } ?
[Bug tree-optimization/81009] missing aliasing optimization for const restrict pointers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81009 --- Comment #2 from Martin Sebor --- Yes, the constness can be cast away without changing the effect of the rule. Similar to the C++ rule we discussed in bug 80794 I feel that constness is an underappreciated opportunity to generate better code in both languages. I agree that constness alone is not sufficient to rely on for optimization because it can be cast away and the object modified, but in conjunction with restrict in C and with other rules in C++ (as discussed in bug 80794) I think it's worth looking into.
[Bug tree-optimization/81009] missing aliasing optimization for const restrict pointers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81009 Marc Glisse changed: What|Removed |Added CC||eyalroz at technion dot ac.il --- Comment #3 from Marc Glisse --- *** Bug 89479 has been marked as a duplicate of this bug. ***