https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122047
Bug ID: 122047
Summary: Incorrect handling of access attribute in uninit pass
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
I think we should warn in foo because we are reading from what the argument
points to and with write_only attribute it might be uninitialized.
But I think we shouldn't warn in the bar case, while p is still a function
argument, its value has been changed to something unrelated.
__attribute__((access (write_only, 1)))
int
foo (int *p)
{
return *p;
}
int *q, *r;
__attribute__((access (write_only, 1)))
int
bar (int *p, int x)
{
if (x == 42)
p = q;
else
p = r;
return *p;
}