From 9724ed840eda8b54fd305df79fb0ac500e338e64 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Wed, 13 Jun 2012 13:14:27 +0000 Subject: [PATCH] A few preliminary GCC 4.7.x changes (nw) --- src/emu/video/polynew.h | 6 ++++++ src/mame/drivers/cobra.c | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/emu/video/polynew.h b/src/emu/video/polynew.h index 4b5fd553f13..926f1efed58 100644 --- a/src/emu/video/polynew.h +++ b/src/emu/video/polynew.h @@ -690,6 +690,12 @@ UINT32 poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_trian } } } + else // GCC 4.7.0 incorrectly claims these are uninitialized; humor it by initializing in the (hopefully rare) zero parameter case + { + param_start[0] = _BaseType(0.0); + param_dpdx[0] = _BaseType(0.0); + param_dpdy[0] = _BaseType(0.0); + } // compute the X extents for each scanline INT32 pixels = 0; diff --git a/src/mame/drivers/cobra.c b/src/mame/drivers/cobra.c index f4e5c4b033c..e145cc7f6d9 100644 --- a/src/mame/drivers/cobra.c +++ b/src/mame/drivers/cobra.c @@ -288,7 +288,7 @@ static void fifo_push(const device_t *cpu, int id, UINT64 data) printf(" "); for (i=0; i < 4; i++) { - UINT64 val; + UINT64 val = 0; fifo_pop(cpu, id, &val); printf("%08X ", (UINT32)(val)); } @@ -368,7 +368,7 @@ static int fifo_pop(const device_t *cpu, int id, UINT64 *result) static int fifo_pop_float(const device_t *cpu, int id, float *result) { - UINT64 value; + UINT64 value = 0; int status = fifo_pop(cpu, id, &value); *result = u2f((UINT32)(value)); return status; @@ -1063,7 +1063,7 @@ static void gfx_fifo_exec(cobra_state *cobra) while (fifo_current_num(GFXFIFO_IN) >= 2) { - UINT64 in1, in2; + UINT64 in1, in2 = 0; UINT32 w1, w2; if (gfx_re_status == RE_STATUS_IDLE) @@ -1104,6 +1104,8 @@ static void gfx_fifo_exec(cobra_state *cobra) if (fifo_current_num(GFXFIFO_IN) < 6) { // wait until there's enough data in FIFO + memset(param, 0, sizeof(param)); + memset(w, 0, sizeof(w)); return; } @@ -1151,7 +1153,7 @@ static void gfx_fifo_exec(cobra_state *cobra) case 0x0f: case 0xf0: { - UINT64 in3, in4, ignore; + UINT64 in3 = 0, in4 = 0, ignore; // check_mergebus_self(): 0x0F600000 0x10520C00 @@ -1346,7 +1348,7 @@ static void gfx_fifo_exec(cobra_state *cobra) for (i=0; i < 3; i++) { - UINT64 in; + UINT64 in = 0; fifo_pop(NULL, GFXFIFO_IN, &in); fifo_pop(NULL, GFXFIFO_IN, &in); @@ -1374,7 +1376,7 @@ static void gfx_fifo_exec(cobra_state *cobra) { for (i=0; i < num; i+=2) { - UINT64 in3, in4; + UINT64 in3 = 0, in4 = 0; fifo_pop(NULL, GFXFIFO_IN, &in3); fifo_pop(NULL, GFXFIFO_IN, &in4); printf(" %08X %08X (%f, %f)\n", (UINT32)(in3), (UINT32)(in4), u2f((UINT32)(in3)), u2f((UINT32)(in4))); @@ -1501,7 +1503,7 @@ static void gfx_fifo_exec(cobra_state *cobra) // writes to n ram location starting from x? for (i = 0; i < num; i++) { - UINT64 value; + UINT64 value = 0; fifo_pop(NULL, GFXFIFO_IN, &value); gfx_gram[reg + (i*4) + 0] = (value >> 24) & 0xff; @@ -1633,7 +1635,7 @@ static void gfx_fifo_exec(cobra_state *cobra) for (i=0; i < num_left; i++) { - UINT64 param; + UINT64 param = 0; fifo_pop(NULL, GFXFIFO_IN, ¶m); gfx_re_word_count++;