#836 unsigned multiplication 8bit x 8bit --> 16 bit fails

closed-accepted
5
2013-05-25
2004-11-17
Raphael Neider
No

Mutliplication of two 8 bit numbers with a desired
16/32 bit result fails to initialize/assign to the
higher result bytes.
This also causes failures when accessing (2
dimensional) arrays like:

<code>
typedef unsigned char byte;

byte large_data[3][4] = {
{1,2,3,4}, {6,7,8,9}, {8,7,6,5}
};

byte demo1 (byte a, byte b) {
return large_data[a][b];
}

int main () {
demo1(2,4);
}
</code>

The errors are located in genarith.c,
pic16_genUMult8XLit_8() and are resolved (hopefully) by
the attached patch.

Raphael Neider

Discussion

  • Raphael Neider
    Raphael Neider
    2004-11-17

    corrected fix for genUMult8X8Lit_8

     
    Attachments
  • Raphael Neider
    Raphael Neider
    2004-11-17

    Logged In: YES
    user_id=1115835

    My last patch had a typo -- new fix available...

    Raphael Neider

     
  • Vangelis Rokas
    Vangelis Rokas
    2004-11-24

    Logged In: YES
    user_id=770505

    Patch applied succesfully, SDCC v. 2.4.7 #888
    although the problem with indexed arrays
    isn't completely solved.

     
  • Vangelis Rokas
    Vangelis Rokas
    2004-11-24

    • milestone: --> known_bugs
    • assigned_to: nobody --> vrokas
    • status: open --> closed-accepted