X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=opcodes%2Fmetag-dis.c;h=5143735e9ed9a0d683a75881843ce243fa6ec551;hb=a8eb42a8b7d48ff6bd12ac83b0e31967b4f5abf1;hp=447f6de6a1d8c2e8f8fe3cb09c146e3505818c23;hpb=a4533ed80a30c66f02ca9946c0354c32c2a5f128;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/metag-dis.c b/opcodes/metag-dis.c index 447f6de6a1..5143735e9e 100644 --- a/opcodes/metag-dis.c +++ b/opcodes/metag-dis.c @@ -1,5 +1,5 @@ /* Disassemble Imagination Technologies Meta instructions. - Copyright (C) 2013 Free Software Foundation, Inc. + Copyright (C) 2013-2018 Free Software Foundation, Inc. Contributed by Imagination Technologies Ltd. This library is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ MA 02110-1301, USA. */ #include "sysdep.h" -#include "dis-asm.h" +#include "disassemble.h" #include "opintl.h" #include @@ -1762,7 +1762,11 @@ print_fmmov (unsigned int insn_word, bfd_vma pc ATTRIBUTE_UNUSED, const insn_template *template, disassemble_info *outf) { - char buf[OPERAND_WIDTH]; + /* We used to have buf[OPERAND_WIDTH] here, but gcc v8 complains + about the snprintf()s below possibly truncating the output. + (There is no way to tell gcc that this truncation is intentional). + So now we use an extra wide buffer. */ + char buf[OPERAND_WIDTH * 2]; char data_buf[REG_WIDTH]; char fpu_buf[REG_WIDTH]; bfd_boolean to_fpu = MAJOR_OPCODE (insn_word) == OPC_GET; @@ -1783,9 +1787,9 @@ print_fmmov (unsigned int insn_word, bfd_vma pc ATTRIBUTE_UNUSED, convert_fx_rmask (rmask), is_mmovl); if (to_fpu) - snprintf (buf, OPERAND_WIDTH, "%s,%s", fpu_buf, data_buf); + snprintf (buf, sizeof buf, "%s,%s", fpu_buf, data_buf); else - snprintf (buf, OPERAND_WIDTH, "%s,%s", data_buf, fpu_buf); + snprintf (buf, sizeof buf, "%s,%s", data_buf, fpu_buf); print_insn (outf, "F", template->name, buf); } @@ -3360,6 +3364,7 @@ print_insn_metag (bfd_vma pc, disassemble_info *outf) bfd_byte buf[4]; unsigned int insn_word; size_t i; + outf->bytes_per_chunk = 4; (*outf->read_memory_func) (pc & ~0x03, buf, 4, outf); insn_word = bfd_getl32 (buf);