Closed GoogleCodeExporter closed 9 years ago
Отсутствует контроль корректности кода в ассемблере. $cat -n test.s 1 .section ".rodata" 2 .align 2 3 .L2: 4 .word 0x0 5 .word 0x1 6 .section ".text" 7 main: 8 set -4,%r13 9 add %r13,%fp,%r13 #ADDRLP2 10 set %r12,.L2 #ADDRGP2 11 set %r13,i #ADDRGP2 12 load %r13,0,%r13 #INDIRI2 13 set %r12,1 #con 14 add %r13,%r13,0 #LSHI2 from emit2 15 lsl %r13,%r12 #LSHI2 from emit2 16 add %r13,%r13,0 #LSHI2 from emit2 17 add %r13,%r13,0 #LSHI2 from emit2 18 set %r12, -4 19 add %r12,%fp,%r12 #ADDRLP2 20 add %r13,%r12,%r13 #ADDP2 21 load %r1,0,%r13 #INDIRI2 22 .L1: 23 return 24 .section ".bss" 25 .type i,#object 26 .size i,2 27 .common i,2,2 $./assembler test.s 1) SETLO %r-4, 13 -> 56333 2) SETHI %r-4, 0 -> 60416 3) add %r13,%fp,%r13 #ADDRLP2 -> 44301 4) SETLO %r12, 1 -> 60417 5) SETHI %r12, 0 -> 64512 6) SETLO %r13, 0 -> 60672 7) SETHI %r13, 0 -> 64768 8) load %r13,0,%r13 #INDIRI2 -> 19725 9) SETLO %r12, 1 -> 60417 10) SETHI %r12, 0 -> 64512 11) add %r13,%r13,0 #LSHI2 from emit2 -> 44496 12) lsl %r13,%r12 #LSHI2 from emit2 -> 15628 13) add %r13,%r13,0 #LSHI2 from emit2 -> 44496 14) add %r13,%r13,0 #LSHI2 from emit2 -> 44496 15) SETLO %r12, 252 -> 60412 16) SETHI %r12, -1 -> 64511 17) add %r12,%fp,%r12 #ADDRLP2 -> 44044 18) add %r13,%r12,%r13 #ADDP2 -> 44493 19) load %r1,0,%r13 #INDIRI2 -> 16653 20) return -> 4369 test.s is translated successfully Вместо падения с выдачей сообщения об ошибке при трансляции инструкции в строке 8: set -4,%r13 Получаем неправильно оттранслированные инструкции: 1) SETLO %r-4, 13 -> 56333 2) SETHI %r-4, 0 -> 60416
Original issue reported on code.google.com by diman...@gmail.com on 14 Mar 2011 at 12:28
diman...@gmail.com
Attachments:
Issue is fixed
Original comment by zaichen...@gmail.com on 27 Mar 2011 at 7:28
zaichen...@gmail.com
Original issue reported on code.google.com by
diman...@gmail.com
on 14 Mar 2011 at 12:28Attachments: