6 ms·
With -O2 gcc actually compiles the program to xorl %eax, %eax ret That is, it optimized away everything.
by kccqzy 10y ago
With -O2 gcc actually compiles the program to
xorl %eax, %eax
ret
That is, it optimized away everything.
- acqq 10y agoYes, that's the correct optimization. That code obviously can't perform printf("error\n") to manifest the bug, and obviously both additions were made compile-time producing the results that are equal.