Hide
Disable optimizations: --opt_level=off
Or change C code from using post increment per below:
Workaround 1: Load into temporary variable first
// bug
long long result = base * (*mult_ptr++);
// Avoid by loading into temporary, then incrementing separately
long long temp = *mult_ptr;
mult_ptr++;
long long result = base * temp;
Workaround 2: Use array indexing instead of pointer arithmetic
// bug
long long *ptr = array;
for (int i = 0; i < n; i++) {
result += base * (*ptr++);
}
// Avoid by using array indexing
for (int i = 0; i < n; i++) {
result += base * array[i];
}
Workaround 3: Manual pointer arithmetic with separate increment
// bug
long long result = base * (*mult_ptr++);
// Avoid with manual arithmetic
long long result = base * (*mult_ptr);
mult_ptr = mult_ptr + 1;
Show
Disable optimizations: --opt_level=off
Or change C code from using post increment per below:
Workaround 1: Load into temporary variable first
// bug
long long result = base * (*mult_ptr++);
// Avoid by loading into temporary, then incrementing separately
long long temp = *mult_ptr;
mult_ptr++;
long long result = base * temp;
Workaround 2: Use array indexing instead of pointer arithmetic
// bug
long long *ptr = array;
for (int i = 0; i < n; i++) {
result += base * (*ptr++);
}
// Avoid by using array indexing
for (int i = 0; i < n; i++) {
result += base * array[i];
}
Workaround 3: Manual pointer arithmetic with separate increment
// bug
long long result = base * (*mult_ptr++);
// Avoid with manual arithmetic
long long result = base * (*mult_ptr);
mult_ptr = mult_ptr + 1;