From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id ABEA4385559A; Mon, 20 Mar 2023 10:33:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABEA4385559A Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Revert "segfault at i386-dis.c:9815" X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: d664a6aad2da8e051d210da2e2b851c1e51faab8 X-Git-Newrev: 834e4d716226b4536bfeb4d20023c69c139eeb5a Message-Id: <20230320103356.ABEA4385559A@sourceware.org> Date: Mon, 20 Mar 2023 10:33:56 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Mar 2023 10:33:56 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D834e4d716226= b4536bfeb4d20023c69c139eeb5a commit 834e4d716226b4536bfeb4d20023c69c139eeb5a Author: Alan Modra Date: Mon Mar 20 20:56:57 2023 +1030 Revert "segfault at i386-dis.c:9815" =20 This reverts commit 92d450c79ad321e42f9a77692b5db10d0f7b9344. =20 Accessing these local var structs using a volatile qualified pointer may indeed read the object, but I don't think changed values are guaranteed to be written back to the object unless the actual object is declared volatile. That would probably slow down i386 disassembly unacceptably. Diff: --- opcodes/i386-dis.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 9684dcda746..a414e8c9b1e 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -9808,17 +9808,12 @@ print_insn (bfd_vma pc, disassemble_info *info, int= intel_syntax) /* Getting here means we tried for data but didn't get it. That means we have an incomplete instruction of some sort. Just print the first byte as a prefix or a .byte pseudo-op. */ - volatile struct dis_private *ppriv =3D &priv; - volatile instr_info *pins =3D &ins; - if (pins->codep > ppriv->the_buffer) + if (ins.codep > priv.the_buffer) { const char *name =3D NULL; =20 - if (pins->prefixes - || pins->fwait_prefix >=3D 0 - || (pins->rex & REX_OPCODE)) - name =3D prefix_name (&ins, ppriv->the_buffer[0], - ppriv->orig_sizeflag); + if (ins.prefixes || ins.fwait_prefix >=3D 0 || (ins.rex & REX_OPCODE)) + name =3D prefix_name (&ins, priv.the_buffer[0], priv.orig_sizeflag); if (name !=3D NULL) i386_dis_printf (&ins, dis_style_mnemonic, "%s", name); else @@ -9827,7 +9822,7 @@ print_insn (bfd_vma pc, disassemble_info *info, int i= ntel_syntax) i386_dis_printf (&ins, dis_style_assembler_directive, ".byte "); i386_dis_printf (&ins, dis_style_immediate, "0x%x", - (unsigned int) ppriv->the_buffer[0]); + (unsigned int) priv.the_buffer[0]); } =20 return 1;