https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128818
Bug ID: 128818
Summary: wrong-code with VN of same-val store
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
Similar to PR128637 and PR128688 the same-value store bypass is affected by
hashtable-insertion triggered wrong-code:
typedef __UINT64_TYPE__ u64;
static inline u64
g(u64 *restrict p, u64 *y, int k, int c)
{
*y = 2;
p[k] = 0;
u64 r = 0;
if (c) r = *p;
return r;
}
__attribute__((noinline)) u64
f(u64 *x, u64 *y, int k, int c)
{
__builtin_memset(x, 0, 16);
u64 r = g(x, y, k, c);
return r + *x;
}
int main()
{
u64 a[2];
u64 r = f(&a[0], &a[0], 1, 0);
if (r != 2)
__builtin_abort ();
return 0;
}