From 137dcb36dbcce15805180dfa534551cf47563828 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Mon, 21 May 2018 05:20:08 +0200 Subject: [PATCH] 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. --- newcpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.3