Why is type conversion int32_t to uint32_t a Sign Change Integer Conversion Overflow Defect in Polyspace?
Mostra commenti meno recenti
Code generated for a division operation with 'Floor' rounding and 'int32' output datatype is generating a Polyspace Defect: 'Sign Change Integer Conversion Overflow'. The supposed overflow occurs in the code where the absoute value of the numerator is calculated. When the numerator is negative, the value is cast as an uint32_T before calculating the two's complement to make it positive. I don't understand how this can overflow. Is this a bug with Polyspace?
Example:
int32_T div_s32_floor(int32_T numerator, etc ...)
{
uint32_T absNum;
...
absNum = (numerator < 0) ? ((~((uint32_T)numerator)) + 1U): ((uint32_T)numerator);
...
}
/* function call */
div_s32_floor(int32_t numerator, etc...);
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Interpret Results in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!