https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689
Martin Liška changed:
What|Removed |Added
Status|UNCONFIRMED |NEW
Last reconfirmed|
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.
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.
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
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++;
}
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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92689
Andrew Pinski changed:
What|Removed |Added
Severity|normal |enhancement
--- Comment #1 from Andrew