# DSP_VectorAbs32 overflows!

Hi,

we are using the DSP_VectorAbs32 function of harmony DSP fixed point math library and recently noticed that it overflows !

This function takes three parameters:

- the output buffer (where to write the result), which should be aligned 4

- the input (the value on which the absolute value should be computed), which should be aligned 4

- the number of absolute values to compute (N), which should be a multiple of 8

Yet, in reality, DSP_VectorAbs32 doesn't write N absolute values in the output but N+4 ! One could think that I could just set the third parameter to N-4, so that it computes N absolute values, but because N-4 is not a multiple of 8 so it doesn't do anything.

I've noticed this bug on different versions of Harmony (1.07.01 and 2.05) and both executing the code on a PIC32MZ2048EFG064 and with the simulator. In order to reproduce the bug, add the following lines in your main and click on "Use DSP fixed point Math library?" in the harmony configurator to link with the library:

static int32_t __attribute__((aligned(4))) out[8];

static int32_t __attribute__((aligned(4))) in[16] = {1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};

int n = 8;

DSP_VectorAbs32(out, in, n);

The easiest in then to directly look at data memory (In MPLabX: Window > PIC Memory Views > Data Memory) and observe that DSP_VectorAbs32 has written 12*sizeof(int32_t) bytes instead of 8*sizeof(int32_t) bytes at the address of the out array.

Has anybody faced this issue ? This kind of bug is really annoying, since it creates erratic bugs and exceptions. What should I do to make sure that Microchip will fix this bug ?

Thank you

post edited by fbirot - 2018/08/15 09:02:58