From 9e2925534b1cc260ac03ecf6417b7d877a21ee76 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 19 Oct 2020 12:28:59 -0700 Subject: [PATCH] I7094: Compiler warning cleanup - Initialize local state variables to 0. Likely non functional changes due to lack of depth in static analysis scan. Coverity detects real problems like this. - Avoid potential out of array indexing due to theoretical array reference via signed char index. Likely non functional change. --- I7094/i7094_cd.c | 4 ++-- I7094/i7094_cpu.c | 2 +- I7094/i7094_lp.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/I7094/i7094_cd.c b/I7094/i7094_cd.c index 7c9cfecc..c03f32cb 100644 --- a/I7094/i7094_cd.c +++ b/I7094/i7094_cd.c @@ -231,7 +231,7 @@ switch (cdr_sta) { /* case on state */ if (uptr->flags & UNIT_CBN) /* column binary? */ colbin = (((uint32) cdr_cbuf[2 * col]) << 6) | ((uint32) cdr_cbuf[(2 * col) + 1]); /* 2 chars -> col bin */ - else colbin = bcd_to_colbin[cdr_cbuf[col]]; /* cvt to col binary */ + else colbin = bcd_to_colbin[cdr_cbuf[col] & 077]; /* cvt to col binary */ dat = bit_masks[35 - (col % 36)]; /* mask for column */ for (row = 0; row < 12; row++) { /* rows 9..0, 11, 12 */ bufw = (row * 2) + (col / 36); /* index to buffer */ @@ -440,7 +440,7 @@ for (col = 0; col < 72; col++) { /* process 72 columns */ } else { /* text */ bcd = colbin_to_bcd (colbin); /* column bin -> BCD */ - cdp_cbuf[col] = pch[bcd]; /* -> ASCII */ + cdp_cbuf[col] = pch[bcd & 077]; /* -> ASCII */ } } for (i = ((2 * CD_CHRLNT) + 1); (i > 0) && diff --git a/I7094/i7094_cpu.c b/I7094/i7094_cpu.c index 073940be..a8ad9450 100644 --- a/I7094/i7094_cpu.c +++ b/I7094/i7094_cpu.c @@ -619,7 +619,7 @@ const uint8 op_flags[1024] = { t_stat sim_instr (void) { t_stat reason = SCPE_OK; -t_uint64 IR, SR, t, t1, t2, sr1; +t_uint64 IR, SR, t, t1, t2, sr1 = 0; uint32 op, fl, tag, tagi, addr, ea; uint32 ch, dec, xr, xec_cnt, trp; uint32 i, j, sc, s1, s2, spill; diff --git a/I7094/i7094_lp.c b/I7094/i7094_lp.c index c09f7ccd..3f312583 100644 --- a/I7094/i7094_lp.c +++ b/I7094/i7094_lp.c @@ -323,7 +323,7 @@ for (col = 0; col < 72; col++) { /* proc 72 columns */ colbin |= col_masks[row]; } bcd = colbin_to_bcd (colbin); /* column bin -> BCD */ - lpt_cbuf[col] = pch[bcd]; /* -> ASCII */ + lpt_cbuf[col] = pch[bcd & 077]; /* -> ASCII */ } for (i = LPT_CHRLNT; (i > 0) && (lpt_cbuf[i - 1] == ' '); --i) ; /* trim spaces */