http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43657
--- Comment #4 from Changpeng Fang <changpeng.fang at amd dot com> 2010-10-19 21:27:46 UTC --- for (k = 0; k < 32; k++) { res = 0; for (j = 0; j < 32; j++) for (i = 0; i < 32; i++) { next = a[i][j]; res = c > cond_array[i+k][j] ? next : res; } out[k] = res; } gcc interchanges i and j loops, which is not legal in this case. Apparently, res takes the last value of a[i][j] that satisfies the condition c > cond_array[i+k][j]. As a result, change in the reference order will get a different value for res. Anyone knows where to do this legality check? What about the interchange in Graphite for this case?