Hello,
customer step over a signed/unsigned int devision which blow up his power supply. Can you check if below compiler behaviour is correct or a bug. There was no compiler warning during compilation.
Result of CAL_mg_s16TestRes1 = CAL_mg_s16TestNom / 4u; is 16379 which is not correct.
Correct behaviour of positive division:
Compiler: ti-cgt-c2000_18.12.8.LTS
#--- Compiler settings --------------------------------------------------------
compiler_flags = \
--silicon_version=28 \
--unified_memory \
--opt_level=3 \
--opt_for_speed=4 \
--opt_for_space \
--c99 \
--single_inline \
--cla_support=cla2 \
--float_support=fpu32 \
--tmu_support=tmu0 \
--vcu_support=vcu0 \
--fp_mode=relaxed \
$(subst -I,--include_path=,$(includes)) \
--symdebug:dwarf \
--define=CPU1 \
--define=_FLASH \
--quiet \
--verbose_diagnostics \
--diag_warning=225 \
--diag_suppress=10063 \
--issue_remarks \
--preproc_with_compile \
--gen_data_subsections=off \
--advice:performance=all \
--pp_directory="$(pp_path)" \
--obj_directory="$(obj_path)" \
--temp_directory="$(tmp_path)" \
--asm_directory="$(asm_path)" \
--list_directory="$(lst_path)"
static int16 CAL_mg_s16TestRes1;
static int16 CAL_mg_s16TestRes2;
static int16 CAL_mg_s16TestRes3;
static int16 CAL_mg_s16TestRes4;
static int16 CAL_mg_s16TestNom;
static int16 CAL_mg_s16TestDenom;
static Uint16 CAL_mg_u16TestDenom;
/* TEST TEST */
CAL_mg_s16TestRes1 = 0;
CAL_mg_s16TestRes2 = 0;
CAL_mg_s16TestRes3 = 0;
CAL_mg_s16TestNom = 20;
CAL_mg_s16TestDenom = 4;
CAL_mg_u16TestDenom = 4u;
CAL_mg_s16TestRes1 = CAL_mg_s16TestNom / 4u;
CAL_mg_s16TestRes2 = CAL_mg_s16TestNom / 4;
CAL_mg_s16TestRes3 = CAL_mg_s16TestNom / CAL_mg_s16TestDenom;
CAL_mg_s16TestRes4 = CAL_mg_s16TestNom / CAL_mg_u16TestDenom;
Uncorrect behaviour of negativ division:

/* TEST TEST */
CAL_mg_s16TestRes1 = 0;
CAL_mg_s16TestRes2 = 0;
CAL_mg_s16TestRes3 = 0;
CAL_mg_s16TestNom = -20;
CAL_mg_s16TestDenom = 4;
CAL_mg_u16TestDenom = 4u;
CAL_mg_s16TestRes1 = CAL_mg_s16TestNom / 4u;
CAL_mg_s16TestRes2 = CAL_mg_s16TestNom / 4;
CAL_mg_s16TestRes3 = CAL_mg_s16TestNom / CAL_mg_s16TestDenom;
CAL_mg_s16TestRes4 = CAL_mg_s16TestNom / CAL_mg_u16TestDenom;

Regards, Holger
