This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix xtensa "clobbered by longjmp" warnings


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ce72cd46ec611fe6440053f282b1b6cb7e977ff6

commit ce72cd46ec611fe6440053f282b1b6cb7e977ff6
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Jun 6 15:30:35 2018 +0930

    Fix xtensa "clobbered by longjmp" warnings
    
    .../opcodes/xtensa-dis.c: In function â??print_insn_xtensaâ??:
    .../opcodes/xtensa-dis.c:257:17: error: variable â??fmtâ?? might be clobbered by â??longjmpâ?? or â??vforkâ?? [-Werror=clobbered]
       xtensa_format fmt;
                     ^~~
    .../opcodes/xtensa-dis.c:262:26: error: variable â??valid_insnâ?? might be clobbered by â??longjmpâ?? or â??vforkâ?? [-Werror=clobbered]
       int first, first_slot, valid_insn = 0;
                              ^~~~~~~~~~
    
    	* xtensa-dis.c (print_insn_xtensa): Init fmt and valid_insn after
    	setjmp.  Move init for some other vars later too.

Diff:
---
 opcodes/ChangeLog    |  5 +++++
 opcodes/xtensa-dis.c | 13 +++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index e0e7382..8ad2f5d 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-06  Alan Modra  <amodra@gmail.com>
+
+	* xtensa-dis.c (print_insn_xtensa): Init fmt and valid_insn after
+	setjmp.  Move init for some other vars later too.
+
 2018-06-04  Max Filippov  <jcmvbkbc@gmail.com>
 
 	* xtensa-dis.c (bfd.h, elf/xtensa.h): New includes.
diff --git a/opcodes/xtensa-dis.c b/opcodes/xtensa-dis.c
index c11cf06..b156544 100644
--- a/opcodes/xtensa-dis.c
+++ b/opcodes/xtensa-dis.c
@@ -259,7 +259,7 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
   static bfd_byte *byte_buf = NULL;
   static xtensa_insnbuf insn_buffer = NULL;
   static xtensa_insnbuf slot_buffer = NULL;
-  int first, first_slot, valid_insn = 0;
+  int first, first_slot, valid_insn;
   property_table_entry *insn_block;
 
   if (!xtensa_default_isa)
@@ -338,16 +338,17 @@ print_insn_xtensa (bfd_vma memaddr, struct disassemble_info *info)
       /* Error return.  */
       return -1;
 
-  /* Don't set "isa" before the setjmp to keep the compiler from griping.  */
-  isa = xtensa_default_isa;
-  size = 0;
-  nslots = 0;
-
   /* Fetch the maximum size instruction.  */
   bytes_fetched = fetch_data (info, memaddr);
 
   insn_block = xtensa_find_table_entry (memaddr, info);
 
+  /* Don't set "isa" before the setjmp to keep the compiler from griping.  */
+  isa = xtensa_default_isa;
+  size = 0;
+  nslots = 0;
+  valid_insn = 0;
+  fmt = 0;
   if (!insn_block || (insn_block->flags & XTENSA_PROP_INSN))
     {
       /* Copy the bytes into the decode buffer.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]