I have a model that performs integer multiplication. The generated code for these operations by Real-Time Workshop 6.0 (R14) and Real-Time Workshop 6.1 (R14SP1) differs. The code generated by Real-Time Workshop 6.0 (R14) typecasts my int16 variables as int32, prior to the multiplication, as follows:
int32_T rtb_Product; rtb_Product = (int32_T)EXT_s16Input * (int32_T)demo_cast_P.Constant1_Value;
The code generated by Real-Time Workshop 6.1 (R14SP1) does not typecast the variables, as shown below:
int32_T rtb_Product; rtb_Product = EXT_s16Input * demo_cast_P.Constant1_Value;
This difference produces incorrect results when an integer overflow occurs due to the multiplication.
Best Answer