From: Thomas Huth Date: Mon, 21 May 2018 03:20:08 +0000 (+0200) Subject: Silence GCC 8 compiler warning in ShowEA() X-Git-Tag: 4000~39^2^2~1 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=137dcb36dbcce15805180dfa534551cf47563828;p=francis%2Fwinuae.git Silence GCC 8 compiler warning in ShowEA() The current version of GCC has gained the possibility to do some additional checks for string operation buffer overflows. It is using the size of source arrays for the check, so in ShowEA it is currently reporting (output taken from Hatari build): newcpu.c: In function 'ShowEA.constprop': newcpu.c:2440:26: warning: '%s' directive writing up to 79 bytes into a region of size between 73 and 75 [-Wformat-overflow=] _stprintf (buffer, _T("(A%d, %s) == $%08x"), reg, offtxt, addr); The offtxt array is only storing a string for a short displacement, so 80 characters is way too big here. Decreasing the size of the array to less characters silences the compiler warning for me. --- diff --git a/newcpu.cpp b/newcpu.cpp index d5b7c1b8..610b356d 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -2283,7 +2283,7 @@ static uaecptr ShowEA (void *f, uaecptr pc, uae_u16 opcode, int reg, amodes mode break; case Ad16: { - TCHAR offtxt[80]; + TCHAR offtxt[8]; disp16 = get_iword_debug (pc); pc += 2; if (disp16 < 0) _stprintf (offtxt, _T("-$%04x"), -disp16);