With gcc 9.3:
if ( a < 100) {
if ( a < 90 ){
if ( a < 80 ) {
return 1;
}
}
}
return 0;
the following is produced
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], edi
cmp DWORD PTR [rbp-4], 99
jg .L2
cmp DWORD PTR [rbp-4], 89
jg .L2
cmp DWORD PTR [rbp-4], 79
jg .L2
mov eax, 1
jmp .L3
.L2:
mov eax, 0
.L3:
pop rbp
ret
As you can see tge jg
just replicate a goto-like behavior
#pragma GCC diagnostic ignored "-Wunused-label"
) with gcc 4.4.7 but I don't have lab systems to easily install older gcc versions.