# New Ticket Created by Simon Glover # Please include the string: [perl #27181] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=27181 >
This code (a cut-down version of mops.pasm): set I2, 0 set I3, 1 set I4, 100000000 print I4 print "\n" set I1, 2 mul I5, I4, I1 REDO: sub I4, I4, I3 if I4, REDO set N1, I5 end prints '100000000' as expected when run with no optimization or with -O. If -O2 is used however, it prints '-1', and the hangs. Disassembly of the optimized bytecode shows that it is being optimized to: set_i_ic I3,1 set_i_ic I4,-1 print_sc "Iterations: " print_ic -1 print_sc "\n" L1: sub_i_i I4,I3 if_i_ic I4,L1 end which is obviously incorrect. NB. Removal of either of the lines involving I5 makes the bug vanish. Simon