Skip to content

Instantly share code, notes, and snippets.

@LebedevRI
Created Aug 10, 2017
Embed
What would you like to do?
some strange llvm miscompile?
#include <assert.h>
int main () {
unsigned short dest[128];
int pred[2];
pred[0] = dest[0];
pred[1] = dest[1];
for (int x = 2; x < 666; x += 2) {
int diff[2];
// else, read next difference from the the output
diff[0] = dest[x];
diff[1] = dest[x + 1];
// else, do prediction, store predicted values
pred[0] += diff[0];
pred[1] += diff[1];
dest[x] = pred[0];
dest[x + 1] = pred[1];
assert(dest[x] == pred[0]);
assert(dest[x + 1] == pred[1]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment