------- Comment #4 from rguenth at gcc dot gnu dot org 2008-10-12 20:45 ------- Another similar, but yet different case:
int test(int a, int b) { int lt = a < b; int eq = a == b; if (lt) return 1; return eq; } this is what we "optimize" it to: test (int a, int b) { int eq; <bb 2>: eq_5 = a_2(D) == b_3(D); if (a_2(D) < b_3(D)) goto <bb 4>; else goto <bb 3>; <bb 3>: <bb 4>: # eq_1 = PHI <1(2), eq_5(3)> return eq_1; test: pushl %ebp movl $1, %eax movl %esp, %ebp movl 12(%ebp), %edx cmpl %edx, 8(%ebp) jl .L3 sete %al movzbl %al, %eax .L3: popl %ebp ret -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28685