https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80625
Bug ID: 80625
Summary: gcc fails to notice strdup does not modify it's
argument
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: prathamesh3492 at gcc dot gnu.org
Target Milestone: ---
Hi,
While working on PR80613, I came up with following test-case:
int f(char *s)
{
void foo(char *);
*s = 'a';
char *p = __builtin_strdup (s);
foo (p);
return *s;
}
I assume return *s could be safely replaced by return 97 since strdup will
not modify s ? Or am I mistaken ?
Thanks,
Prathamesh