Closed
Description
Bugzilla Link | 47523 |
Version | trunk |
OS | Linux |
Attachments | reproducer, reproducer.ll |
CC | @fhahn |
Extended Description
$ clang -mllvm -enable-loopinterchange -O2 reproducer.c -w && ./a.out
11
$ clang -O0 reproducer.c -w && ./a.out
9
LoopInterchange wrongly interchanges loops in the following function "h()", in which the order of *s=3 matters:
struct a {
unsigned char b
} c[];
d, e, g;
f[4][9] = {5, 3};
h() {
for (; d <= 2; d++) {
for (e = 0; e <= 2; e++) {
short *s = &g;
if ((long)(f[e][d] && (*s = 3), c) % 4073709551606)
++*s;
}
}
}
main() {
h();
printf("%d\n", g);
}