https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49054
Paweł Bylica <chfast at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chfast at gmail dot com --- Comment #7 from Paweł Bylica <chfast at gmail dot com> --- GCC 13 generates optimal decision tree for the mentioned modified case. if id == 3: i() elif id <= 3: if id == 0: f() else: # 1 g() else: if id == 4: j() else: # 23456 h() https://godbolt.org/z/9j6b88qKE So I think this issue is fixed.