Bug 10766 - Variable defined inside code in gas/config/tc-i386.c
Summary: Variable defined inside code in gas/config/tc-i386.c
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-13 11:24 UTC by Jerker Bäck
Modified: 2009-10-13 16:45 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-interix6.1
Target: x86_64-unknown-interix6.1
Build: x86_64-unknown-interix6.1
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerker Bäck 2009-10-13 11:24:36 UTC
The variable "expressionS *exp" is defined inside function code block.

===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.399
diff -w -b -B -u -p -r1.399 tc-i386.c
--- config/tc-i386.c	1 Oct 2009 14:31:43 -0000	1.399
+++ config/tc-i386.c	13 Oct 2009 02:16:43 -0000
@@ -4866,6 +4866,7 @@ build_modrm_byte (void)
   const seg_entry *default_seg = 0;
   unsigned int source, dest;
   int vex_3_sources;
+  expressionS *exp;
 
   /* The first operand of instructions with VEX prefix and 3 sources
      must be VEX_Imm4.  */
@@ -4896,7 +4897,7 @@ build_modrm_byte (void)
 
       /* Generate an 8bit immediate operand to encode the register
 	 operand.  */
-      expressionS *exp = &im_expressions[i.imm_operands++];
+      exp = &im_expressions[i.imm_operands++];
       i.op[i.operands].imms = exp;
       i.types[i.operands] = imm8;
       i.operands++;
Comment 1 cvs-commit@gcc.gnu.org 2009-10-13 16:42:56 UTC
Subject: Bug 10766

CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2009-10-13 16:42:40

Modified files:
	gas            : ChangeLog 
	gas/config     : tc-i386.c 

Log message:
	2009-10-13  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR binutils/10766
	* config/tc-i386.c (build_modrm_byte): Declare exp earlier.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.3984&r2=1.3985
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-i386.c.diff?cvsroot=src&r1=1.400&r2=1.401

Comment 2 H.J. Lu 2009-10-13 16:45:26 UTC
Fixed.