https://bugs.kde.org/show_bug.cgi?id=444110

Carl Love <c...@us.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REPORTED                    |CONFIRMED
     Ever confirmed|0                           |1

--- Comment #4 from Carl Love <c...@us.ibm.com> ---
The current code:
        if (is_prefix && ( ptype == pType1 ) ) {
            if ( !(allow_isa_3_1) ) goto decode_noIsa3_1;
            // splat instructions: xxpermx                                      
            if (dis_vector_permute_prefix( prefix, theInstr, abiinfo ))
               goto decode_success;
         } else if (is_prefix && ( ptype == pType1 ) ) {  // plbz:  load
instruction                                                                     
            if ( !(allow_isa_3_1) ) goto decode_noIsa3_1;
            if (dis_int_load_prefix( prefix, theInstr ))
               goto decode_success;
         } else {  // lbz:  load instruction                    
            if (dis_int_load_prefix( prefix, theInstr ))
               goto decode_success;
         }

The above code is wrong.  The else if should be checking for the plbz
instruction.  The plbz instruction is pType2 not 1.    The else if case fails
for the plbz instruction and we hit the else statement.  The else statement is
supposed to only succeed for the lpz instruction.  However, it is actually
handling both the plbz and lbz instructions.  The same function
dis_int_load_prefix() handles both the prefix and non-prefixed versions of the
instruction.  They are distinquished by the prefix argument.  The else
statement should only succeed for the lbz instruction, i.e. not a prefixed
instruction.  So we really have two errors, the else if should check for pType2
and the else should really be else if (!prefix).

The code should be:
        if (is_prefix && ( ptype == pType1 ) ) {
            if ( !(allow_isa_3_1) ) goto decode_noIsa3_1;
            // splat instructions: xxpermx                                      
            if (dis_vector_permute_prefix( prefix, theInstr, abiinfo ))
               goto decode_success;
         } else if (is_prefix && ( ptype == pType2 ) ) {  // plbz:  load
instruction                                                                     
            if ( !(allow_isa_3_1) ) goto decode_noIsa3_1;
            if (dis_int_load_prefix( prefix, theInstr ))
               goto decode_success;
         } else if (!is_prefix) {  // lbz:  load instruction                    
            if (dis_int_load_prefix( prefix, theInstr ))
               goto decode_success;
         }

Tested the original code and verified the else was handling both the prefixed
and non-prefixed lbz instructions.  Tested the correct code to verify that the
prefixed instruction matches is_prefix and ptype == pType2.   Ran the
regression tests to verify the correct code does not introduce any failures.

In this case, I just got lucky and the code did the right thing in spite of the
coding error.  Better to be lucky than good!  :-)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to