https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752
--- Comment #21 from Chung-Kil Hur <gil.hur at sf dot snu.ac.kr> --- (In reply to Marek Polacek from comment #20) > (In reply to Chung-Kil Hur from comment #19) > > (In reply to rguent...@suse.de from comment #18) > > > On Tue, 19 May 2015, gil.hur at sf dot snu.ac.kr wrote: > > > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752 > > > > > > > > --- Comment #17 from Chung-Kil Hur <gil.hur at sf dot snu.ac.kr> --- > > > > Hi Richard, > > > > > > > > I modified the example further. > > > > > > > > #include <stdio.h> > > > > > > > > int main() { > > > > int x = 0; > > > > uintptr_t xp = (uintptr_t) &x; > > > > uintptr_t i, j; > > > > > > > > for (i = 0; i < xp; i++) { } > > > > j = i; > > > > /* The following "if" statement is never executed because j == xp */ > > > > if (j != xp) { > > > > printf("hello\n"); > > > > j = xp; > > > > } > > > > > > Here j is always xp and thus ... > > > > > > > Why is "j" always "xp"? > > Since "hello" is not printed, "j = xp;" is not executed. > > Because that "if (j != xp)" guarantees it. OK. here is another modification. #include <stdio.h> int main() { int x = 0; uintptr_t xp = (uintptr_t) &x; uintptr_t i, j; for (i = 0; i < xp; i++) { } j = i; *(int*)j = 15; /* The following "if" statement is never executed because j == xp */ if (j != xp) { printf("hello\n"); j = xp; } *(int*)((xp+i)-j) = 15; printf("%d\n", x); } This program just prints "0". So we know that "*(int*)j = 15;" is not executed and thus "j == xp" is not true. Then, can the following statement change "j" even if the printf is not executed? if (j != xp) { printf("hello\n"); j = xp; } If not, how can "j == xp" suddenly hold?