https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51840
Kai Tietz <ktietz at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-06-18 CC| |ktietz at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #5 from Kai Tietz <ktietz at gcc dot gnu.org> --- So original issue is caused by two issues. For initial expand we produce the following rtl for the first code-switch: (jump_insn 32 31 34 2 (parallel [ (asm_operands/v ("jmp *%0") ("") 0 [ (mem/v/f/j:DI (plus:DI (mult:DI (reg:DI 136) (const_int 8 [0x8])) (reg/f:DI 135)) [0 vm_dispatch S8 A64]) ] [ (asm_input:DI ("m") t_asmgoto.c:65) ] [ (label_ref:DI 36) (label_ref:DI 56) (label_ref:DI 114) (label_ref:DI 120) ] t_asmgoto.c:65) (clobber (reg:QI 18 fpsr)) (clobber (reg:QI 17 flags)) (clobber (mem:BLK (scratch) [0 A8])) ]) t_asmgoto.c:65 -1 (insn_list:REG_LABEL_TARGET 36 (insn_list:REG_LABEL_TARGET 56 (insn_list:REG_LABEL_TARGET 114 (nil)))) -> 120) (note 34 32 33 4 [bb 4] NOTE_INSN_BASIC_BLOCK) (note/s 33 34 35 4 ("atop__a_dec") NOTE_INSN_DELETED_LABEL 2) (barrier 35 33 36) (code_label 36 35 37 5 8 "" [3 uses]) ... Of interest is here the '(note/s 33 34 35 4 ("atop__a_dec") NOTE_INSN_DELETED_LABEL 2)'. As long as code_label 36 (which is implementation of "atop__a_dec" code) follows directly that note, we are fine. That's true for -Os, -O0, and -O1. For -O2 we exectute additional the basic-block-reorder pass, and that moves label 36 away. Nevertheless the semi-deleted label-note remains and cause the wrong code-path.