Quiz Entry - updated: 2026.07.06
How do you recognize fall-through in a switch statement's assembly?
A case block with no jmp at its end falls through into the next case's code (the C source omitted break).
* No jmp at a case's end = fall-through into the next case. *
# case 2: (has fall-through)
.L5:
movq %rsi, %rax
cqto
idivq %rcx
# No jmp here! Falls through to .Lmerge
# Shared code (case 2 falls into case 3's merge point)
.Lmerge:
addq %rcx, %rax
vs a normal case (no fall-through):
# case 1: (breaks)
.L3:
movq %rdi, %rax
jmp .L_exit
How to spot it:
- Case with
jmpat the end → hasbreakin C - Case without
jmpat the end → falls through to next case - Multiple labels at the same address →
case 5: case 6:(combined cases)
In GDB: Step through a case block. If execution continues to the next case label without a jump, it's fall-through.
Go deeper: