-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Code Generation Tools
-
CODEGEN-15522
-
-
-
default
-
At optimization levels -o2 and higher, the compiler can generate incorrect code for loops that update a restrict-qualified array using a min/max-style reduction. The array element may retain a stale value instead of being updated.
How it manifests in source:
void update(int8_t* restrict out, const int8_t* restrict in)
{
for (int i = 0; i < N; i++)
}
Workaround 1:
Remove restrict from the affected pointer(s).
void update(int8_t* out, const int8_t* in)
Workaround 2:
Rewrite the reduction to avoid the min/max idiom, keeping restrict.
void update(int8_t* restrict out, const int8_t* restrict in)
{
for (int i = 0; i < N; i++)
}