This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] crx string overflow warning
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 26 Feb 2018 00:21:56 -0000
- Subject: [binutils-gdb] crx string overflow warning
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e95b887f85a192eb1597cd5d358673520029ad14
commit e95b887f85a192eb1597cd5d358673520029ad14
Author: Alan Modra <amodra@gmail.com>
Date: Sat Feb 24 10:33:33 2018 +1030
crx string overflow warning
gcc8 complains wrongly about the buffer not being large enough, at
least at -Og optimization.
* crx-dis.c (getregliststring): Allocate a large enough buffer
to silence false positive gcc8 warning.
Diff:
---
opcodes/ChangeLog | 5 +++++
opcodes/crx-dis.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 325972f..0f47a20 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-26 Alan Modra <amodra@gmail.com>
+
+ * crx-dis.c (getregliststring): Allocate a large enough buffer
+ to silence false positive gcc8 warning.
+
2018-02-22 Shea Levy <shea@shealevy.com>
* disassemble.c (ARCH_riscv): Define if ARCH_all.
diff --git a/opcodes/crx-dis.c b/opcodes/crx-dis.c
index a70ab81..27a2aa8 100644
--- a/opcodes/crx-dis.c
+++ b/opcodes/crx-dis.c
@@ -244,7 +244,7 @@ powerof2 (int x)
void
getregliststring (int mask, char *string, enum REG_ARG_TYPE core_cop)
{
- char temp_string[5];
+ char temp_string[16];
int i;
string[0] = '{';